Deploy the sumokube helm chart on Digital Ocean Kubernetes Service
TypeScriptTo deploy the Sumo Logic Helm chart (referred to as
sumokube
) on the Digital Ocean Kubernetes Service using Pulumi, we'll follow these steps:- Set up the Digital Ocean Kubernetes cluster.
- Install the Helm chart onto the cluster.
We're going to use two Pulumi resources:
digitalocean.KubernetesCluster
to create the Kubernetes cluster andkubernetes.helm.v3.Chart
for deploying the Helm chart onto the cluster.1. Set up the Digital Ocean Kubernetes cluster
First, we define a Kubernetes cluster in Digital Ocean using
digitalocean.KubernetesCluster
. We'll need to provide a name, region, version for the Kubernetes software, and configurations for the node pool which defines the size and number of Droplets (VMs) acting as worker nodes.2. Install the Helm chart onto the cluster
Once we have the cluster, we'll use
kubernetes.helm.v3.Chart
to deploy the Helm chart. This resource is a Pulumi abstraction that represents a Helm chart, allowing us to deploy third-party applications easily. We need to specify the repository where the Helm chart is located, the chart name, and any custom values we wish to provide.Below is a TypeScript program that accomplishes these tasks:
import * as digitalocean from "@pulumi/digitalocean"; import * as kubernetes from "@pulumi/kubernetes"; // Step 1: Create a Digital Ocean Kubernetes cluster. const cluster = new digitalocean.KubernetesCluster("do-cluster", { region: "nyc3", version: "latest", // Use the latest available version of Kubernetes nodePool: { size: "s-1vcpu-2gb", // This specifies the size of each Droplet nodeCount: 2, // Number of Droplets in the Node Pool }, }); // Step 2: Install the Helm chart into the cluster. // We use the kubeconfig provided by the Digital Ocean cluster to interact with it. const kubeconfig = cluster.kubeConfigs[0].rawConfig; // Initialize a new K8s provider with the kubeconfig from the cluster we've just provisioned. const k8sProvider = new kubernetes.Provider("k8s-provider", { kubeconfig: kubeconfig, }); // Deploy the Helm chart using Helm provider. const sumokubeChart = new kubernetes.helm.v3.Chart("sumokube", { // Replace with the actual chart name if different. chart: "sumologic", // Add the repository where sumologic Helm chart is located, // for example, if it's hosted on Helm Hub or any other Helm repository. fetchOpts: { repo: "https://sumologic.github.io/sumologic-kubernetes-collection", }, },{ provider: k8sProvider, }); // Export the cluster's kubeconfig and the Helm chart name. export const kubeConfigOutput = kubeconfig; export const chartName = sumokubeChart.metadata.name;
In this program, we're first setting up the Digital Ocean cluster with two small Droplets that will form our node pool. We choose "nyc3" as our region, but you should replace this with the region closer to you or where your application users will be.
For the Helm chart installation, we're using a provider created with the kubeconfig from the Digital Ocean Kubernetes cluster which gives us the credentials needed to run commands against the cluster, such as installing a Helm chart.
You'll need to adjust the Helm chart information, such as
chart
andrepo
, to match the actual Sumo Logic chart you want to deploy. Once the Helm chart is deployed, you can interact with it usingkubectl
or any other Kubernetes tools using the exportedkubeConfigOutput
.Make sure you have Pulumi CLI and the Digital Ocean provider configured correctly on your machine before running this code. After running it with
pulumi up
, it will set up a Kubernetes cluster in your Digital Ocean account and deploy the Sumo Logic Helm chart to that cluster.