Deploy the nginx-vts-exporter helm chart on Digital Ocean Kubernetes Service
TypeScriptDeploying the
nginx-vts-exporter
Helm chart on a Digital Ocean Kubernetes Service (DOKS) cluster involves a few steps:-
Setting up a DOKS Cluster: First, you need to create a Kubernetes cluster on Digital Ocean. This is where the Helm chart will be deployed.
-
Installing the Helm Chart: After the cluster is up and running, you can use the Helm Package Manager to install the
nginx-vts-exporter
chart into the cluster.
The following Pulumi program written in TypeScript demonstrates how to accomplish the above steps. It assumes that you have the necessary prerequisites installed:
- Pulumi CLI
- Kubernetes CLI (
kubectl
) - Helm CLI (
helm
)
Before running the Pulumi program, ensure that you have authenticated with Digital Ocean and have set up the Pulumi CLI with credentials to interact with Digital Ocean's API.
Detailed Pulumi Program
Below is the Pulumi program that accomplishes the task:
import * as pulumi from '@pulumi/pulumi'; import * as digitalocean from '@pulumi/digitalocean'; import * as k8s from '@pulumi/kubernetes'; // Step 1: Create a new Digital Ocean Kubernetes cluster const cluster = new digitalocean.KubernetesCluster('do-cluster', { region: digitalocean.Regions.NYC1, // Choose the region that is best for you version: 'latest', // Specify the DOKS version or use 'latest' nodePool: { name: 'default', size: digitalocean.DropletSlugs.DOS2vCPU4GB, // Choose the droplet size nodeCount: 3, // Set the number of nodes in the pool }, }); // Step 2: Using a Kubernetes Provider to interact with the DOKS cluster const k8sProvider = new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeConfigs[0].rawConfig, }); // Step 3: Install the nginx-vts-exporter Helm chart into the cluster const nginxVtsExporter = new k8s.helm.v3.Chart('nginx-vts-exporter', { chart: 'nginx-vts-exporter', // This should be the name of the chart in the Helm repository version: '0.10.3', // Specify the chart version you want to deploy fetchOpts: { repo: 'https://helm.repo.url/', // Add the URL of the Helm repository containing your chart }, }, { provider: k8sProvider }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeConfigs[0].rawConfig; // After running `pulumi up`, the DOKS cluster will be created and the nginx-vts-exporter Helm chart will be installed.
Make sure to replace the placeholders (like
https://helm.repo.url/
with the actual helm repository URL where thenginx-vts-exporter
chart is hosted) with the appropriate values.I would like to emphasize that the
chart
property undernginxVtsExporter
should be the actual chart name found within the repository, andversion
should be the desired chart version.A Note on Versions: Specifying
'latest'
for the Kubernetes cluster version will ensure that you get the latest stable release of Kubernetes supported by Digital Ocean. Be sure to manage versions responsibly in production environments to ensure compatibility and avoid surprises from automatic upgrades.After writing and deploying the above Pulumi program (using
pulumi up
), you should have a DOKS cluster running and thenginx-vts-exporter
Helm chart deployed.Additionally, the
kubeconfig
is exported from the script, which will allow you to interact with your Kubernetes cluster usingkubectl
with the proper context set. Remember to keep your kubeconfig secure, as it grants access to your Kubernetes cluster.To check that the
nginx-vts-exporter
is running, you can runkubectl get pods
once the Pulumi program has successfully completed. This will list the running Pods in the cluster, and you should see thenginx-vts-exporter
listed there.-