Deploy the seldon-core-crd helm chart on Digital Ocean Kubernetes Service
TypeScriptTo deploy the
seldon-core-crd
Helm chart on Digital Ocean Kubernetes Service using Pulumi, you would first need a Kubernetes cluster on Digital Ocean. Then, you can use@pulumi/kubernetes
to deploy the helm chart to that cluster. Here's a step-by-step guide on how you can accomplish this:-
Setting up the Digital Ocean Kubernetes Cluster
First, you'll need to provision a Digital Ocean Kubernetes (DOKS) cluster. We will be using the
digitalocean.KubernetesCluster
resource from the@pulumi/digitalocean
package for this purpose. We choose this resource because it provides all required configuration options to create a managed Kubernetes cluster in Digital Ocean. -
Installing the seldon-core-crd Helm Chart
Once the Kubernetes cluster is set up, the next step is to install
seldon-core-crd
. We'll use thekubernetes.helm.v3.Chart
resource from the@pulumi/kubernetes
package. This resource allows you to provide the chart name, version, and other configurations directly, and Pulumi will manage the Helm release for you.
Below is a Pulumi program in TypeScript that sets up a Digital Ocean Kubernetes cluster and deploys the
seldon-core-crd
Helm chart to it:import * as digitalocean from "@pulumi/digitalocean"; import * as kubernetes from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Step 1: Create a new Digital Ocean Kubernetes cluster const cluster = new digitalocean.KubernetesCluster("do-cluster", { region: "nyc3", version: "latest", // Specify the desired Kubernetes version or use "latest" nodePool: { name: "default", size: "s-2vcpu-2gb", // This is the Droplet size to use for workers (check Digital Ocean pricing page for more sizes) nodeCount: 2, // The number of Droplet workers to provision }, }); // Step 2: Use the kubeconfig from the generated cluster to interact with it using the Kubernetes provider const k8sProvider = new kubernetes.Provider("k8s-provider", { kubeconfig: cluster.kubeConfigs[0].rawConfig, }); // Step 3: Deploy the seldon-core-crd Helm chart const chart = new kubernetes.helm.v3.Chart("seldon-core-crd", { chart: "seldon-core-crd", version: "1.11.0", // Replace with the desired version of the Helm chart fetchOpts: { repo: "https://storage.googleapis.com/seldon-charts" }, // Optionally, specify the values for the Helm chart customizations values: { // Add customizations here if needed }, }, { provider: k8sProvider }); // Export the public IP of the cluster to access it externally export const clusterEndpoint = cluster.endpoint; // Export the kubeconfig to interact with the cluster through kubectl export const kubeconfig = cluster.kubeConfigs[0].rawConfig;
How to use this code:
- You need to have Pulumi installed and configured with Digital Ocean access.
- Store this code in an
index.ts
file in a new Pulumi project directory. - The program specifies a
s-2vcpu-2gb
size for the Droplets, which are the worker nodes in the cluster. This is a general-purpose size, but you should adjust it as per your workload requirements. - The
version
field in the Helm chart is set to a specific version (1.11.0
). You should update this field to the version ofseldon-core-crd
you want to deploy, or remove theversion
field to deploy the latest version. - The
values
object in the Helm chart is left empty, but you can fill it in if you need to customize the Helm chart's configuration parameters. - The
kubeconfig
export allows you to interact with the cluster usingkubectl
once it's set up. It's printed as output when you runpulumi up
.
To deploy this configuration:
- Initialize a new Pulumi project in your terminal using
pulumi new typescript
. - Copy and paste the code above into your
index.ts
file in your Pulumi project. - Run
pulumi up
to preview and deploy the changes. - Once the deployment is finished, you can get the Kubernetes cluster endpoint and the kubeconfig file from the Pulumi stack's outputs.
This code sets up the infrastructure and deploys
seldon-core-crd
in a repeatable and codified manner. With Pulumi, you can track the state of your deployment, manage changes through code, and automate complex provisioning tasks.-