Deploy the openobserve helm chart on Digital Ocean Kubernetes Service
TypeScriptTo deploy the openobserve Helm chart on Digital Ocean Kubernetes Service (DOKS) using Pulumi, you will need to perform the following high-level steps:
- Set up a new Digital Ocean Kubernetes cluster if you don't have one already.
- Install the Helm chart into your Kubernetes cluster.
Below is a Pulumi program written in TypeScript that achieves these goals. This program will first create a DOKS cluster, and then deploy the openobserve Helm chart onto that cluster.
Before we get into the code, here's a brief breakdown of the Pulumi resources used in this program:
digitalocean.KubernetesCluster
: This resource will create a new Kubernetes cluster on Digital Ocean.kubernetes.helm.v3.Chart
: This Helm chart resource represents a Helm chart from a repository, which can be deployed on a Kubernetes cluster.
Here’s how the TypeScript Pulumi code to deploy the openobserve Helm chart on DOKS looks:
import * as digitalocean from "@pulumi/digitalocean"; import * as kubernetes from "@pulumi/kubernetes"; // Create a Digital Ocean Kubernetes cluster. const cluster = new digitalocean.KubernetesCluster("do-cluster", { region: "nyc3", version: "latest", nodePool: { name: "default", size: "s-2vcpu-2gb", nodeCount: 2, }, }); // Create a Kubernetes provider instance using the kubeconfig from the cluster we created. const k8sProvider = new kubernetes.Provider("k8s-provider", { kubeconfig: cluster.kubeConfigs[0].rawConfig, }); // Deploy the openobserve Helm chart to the Digital Ocean Kubernetes cluster. const openobserveChart = new kubernetes.helm.v3.Chart("openobserve", { chart: "openobserve", version: "0.1.0", // Specify the version of the Helm chart you want to deploy namespace: "default", // Specify the namespace where the Helm chart should be installed }, { provider: k8sProvider }); // Export the cluster's kubeconfig and endpoint. export const kubeconfig = cluster.kubeConfigs[0].rawConfig; export const clusterEndpoint = cluster.endpoint;
In this Pulumi program:
- We initialize a new DOKS cluster by specifying the region, Kubernetes version, and the node pool configuration.
- We then create a Kubernetes provider using the kubeconfig that is generated from our new DOKS cluster. This provider will be used to interact with our Kubernetes cluster.
- Next, we declare a Helm
Chart
resource specifyingopenobserve
as the chart we want to deploy, along with its version. We also attach thek8sProvider
to ensure it installs the chart on our new DOKS cluster. - Finally, we export the kubeconfig and the cluster endpoint. The kubeconfig is needed to interact with the Kubernetes cluster using
kubectl
or other Kubernetes tools.
To apply this program:
- You'll need to have the Pulumi CLI installed and set up with appropriate access to manipulate resources in Digital Ocean.
- You need to have
kubectl
installed if you wish to interact with the cluster after deployment. - Save this program in a TypeScript file (e.g.,
index.ts
), ensure you have a validPulumi.yaml
and runpulumi up
to create the resources.
Once the command is complete, the Digital Ocean Kubernetes cluster and the openobserve Helm chart will be deployed. You can then use
kubectl
with the provided kubeconfig to interact with your Kubernetes cluster and verify that openobserve was deployed correctly.