Deploy the shipwright-build helm chart on Digital Ocean Kubernetes Service
TypeScriptTo deploy the Shipwright Build Helm chart on DigitalOcean Kubernetes Service (DOKS), you will first need to set up a Kubernetes cluster on DigitalOcean. Once your cluster is set up and configured, you will deploy the Helm chart to the cluster.
Below is a detailed explanation and a corresponding Pulumi program, which will:
- Create a DOKS cluster.
- Deploy the Shipwright Build Helm chart to the cluster using Pulumi's Kubernetes and Helm integrations.
Before running this code, ensure you have the following prerequisites:
- Pulumi CLI installed and configured for use with your DigitalOcean account.
kubectl
installed and configured to communicate with your Kubernetes clusters.- Helm CLI installed if you need to customize chart values or manage Helm releases manually.
Let's begin with the Pulumi program written in TypeScript:
import * as pulumi from '@pulumi/pulumi'; import * as digitalocean from '@pulumi/digitalocean'; import * as k8s from '@pulumi/kubernetes'; // Step 1: Create a DigitalOcean Kubernetes cluster. const cluster = new digitalocean.KubernetesCluster('doks-cluster', { region: 'nyc3', version: 'latest', // specify the desired Kubernetes version nodePool: { name: 'worker-pool', size: 's-2vcpu-2gb', // This is the smallest size suitable for testing. nodeCount: 2, }, }); // Step 2: Deploy the Shipwright Build Helm chart to the cluster. const helmChart = new k8s.helm.v3.Chart('shipwright-build', { chart: 'shipwright-build', version: '0.1.0', // replace this with the actual chart version you want to deploy namespace: 'default', // specify the namespace where you want to deploy fetchOpts: { repo: 'https://charts.shipwright.io', // provide the exact URL of the Shipwright Helm chart repository }, }, { provider: new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeConfigs[0].rawConfig }) }); // Export the cluster endpoint and the Helm chart information export const kubeconfig = cluster.kubeConfigs[0].rawConfig; export const chart = helmChart.metadata.apply(metadata => metadata.name);
In this program:
- We import the necessary Pulumi libraries for TypeScript.
- We define a DigitalOcean Kubernetes cluster resource using
@pulumi/digitalocean
.- The
region
,version
, andnodePool
parameters are specified to customize the DOKS cluster. - The
latest
Kubernetes version will be used; you may choose a specific version if required. - The
nodePool
is configured with an appropriate instance size. Depending on your workload, you might need larger instances.
- The
- We then define a Helm chart resource using
@pulumi/kubernetes
.- The
chart
andversion
properties specify which Helm chart to deploy and which version. - The
namespace
specifies which Kubernetes namespace to deploy the chart into. - The
repo
underfetchOpts
specifies the Helm repository where the Shipwright Build chart can be found.
- The
- We use the DOKS cluster's
kubeconfig
to create a Kubernetes provider for Pulumi, which allows us to interact with our new cluster. - In the exports, we output the raw kubeconfig needed to interact with the cluster using
kubectl
and the name of the deployed Helm chart.
Keep in mind,
shipwright-build
and the version0.1.0
are placeholders; you will need the actual chart name and its version. Also, you can adjust theregion
,nodeCount
, andsize
as per your requirements.After deploying this Pulumi program, the Shipwright Build Helm chart will be installed on your DigitalOcean Kubernetes cluster.