Deploy the OneUptime helm chart on Digital Ocean Kubernetes Service
TypeScriptTo deploy the OneUptime helm chart on the Digital Ocean Kubernetes Service using Pulumi, we need to accomplish a few high-level tasks:
- Create a Kubernetes cluster on Digital Ocean.
- Install the Helm chart into the Kubernetes cluster.
We will use two Pulumi resources for these tasks:
digitalocean.KubernetesCluster
to create the Kubernetes cluster.kubernetes.helm.sh/v3.Chart
to install the OneUptime Helm chart.
The
digitalocean.KubernetesCluster
will instantiate a new Kubernetes cluster on Digital Ocean, including the configuration necessary for node size, region, and the number of nodes. After the cluster is up and running, we'll use thekubernetes.helm.sh/v3.Chart
resource. This resource is responsible for installing a Helm chart, which in this case is the OneUptime application.Here is a basic Pulumi program in TypeScript that performs these steps. This program assumes you have already set up your Pulumi and DigitalOcean credentials.
import * as digitalocean from '@pulumi/digitalocean'; import * as k8s from '@pulumi/kubernetes'; import * as pulumi from '@pulumi/pulumi'; // Create a DigitalOcean Kubernetes cluster with the desired settings const cluster = new digitalocean.KubernetesCluster('do-cluster', { region: 'nyc1', version: 'latest', nodePool: { name: 'default', size: 's-2vcpu-2gb', // Choose the size that fits your needs or the OneUptime requirements nodeCount: 2, // You can specify the number of nodes (workers) you need }, }); // Export the cluster's kubeconfig and name export const kubeconfig = cluster.kubeConfigs[0].rawConfig; export const clusterName = cluster.name; // Create a Kubernetes provider instance using the kubeconfig from our cluster const k8sProvider = new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeConfigs[0].rawConfig, }); // Deploy the OneUptime Helm chart to the DigitalOcean Kubernetes cluster const oneUptimeChart = new k8s.helm.sh.v3.Chart('oneuptime-chart', { chart: 'oneuptime', // Make sure this is the name of the OneUptime chart in the Helm repository version: '1.0.0', // Replace with the actual version you wish to install fetchOpts: { repo: 'https://helm.oneuptime.com', // Use the correct repository URL }, }, { provider: k8sProvider }); // Export the OneUptime endpoint to access the application export const oneUptimeEndpoint = cluster.endpoint;
In this program, we create a Digital Ocean Kubernetes cluster with the
digitalocean.KubernetesCluster
resource. We specify the region, Kubernetes version, and configure the node pool with the desired size and node count. Afterward, we export thekubeconfig
to facilitate interaction with the cluster usingkubectl
.With our cluster defined, we set up a Pulumi Kubernetes provider that uses the
kubeconfig
of the newly created cluster. This provider will be used by Kubernetes-related resources to interact with the cluster.Next, we use the
k8s.helm.sh/v3.Chart
resource to deploy the OneUptime Helm chart. We specify the chart name and chart version and provide a repository URL where the chart is located. By supplying the Kubernetes provider to this resource, we are instructing Pulumi to deploy the Helm chart into the cluster we created earlier.Lastly, we export the cluster endpoint, which can be used to access OneUptime once it's deployed.
To use this program, save it to a file (e.g.,
index.ts
), runpulumi up
, and follow the CLI prompts to deploy the resources. After the deployment is complete, you can use the exportedkubeconfig
andoneUptimeEndpoint
to manage and access your OneUptime installation.