1. Answers
  2. Deploy the zookeeper-3Nodes helm chart on Digital Ocean Kubernetes Service

How do I deploy the zookeeper-3Nodes helm chart on Digital Ocean Kubernetes Service?

To deploy the zookeeper-3Nodes Helm chart on a DigitalOcean Kubernetes Service (DOKS) using Pulumi, we need to follow these steps:

  1. Create a DigitalOcean Kubernetes Cluster: We’ll start by creating a Kubernetes cluster on DigitalOcean.
  2. Deploy the Helm Chart: Next, we’ll deploy the zookeeper-3Nodes Helm chart on the newly created Kubernetes cluster.

Here’s a detailed explanation of the resources we’ll use:

  • digitalocean.KubernetesCluster: This resource will create a Kubernetes cluster on DigitalOcean.
  • kubernetes.helm.v3.Release: This resource will deploy the zookeeper-3Nodes Helm chart on the Kubernetes cluster.

Step-by-Step Guide

  1. Install Pulumi CLI: Make sure you have the Pulumi CLI installed and configured.
  2. Configure DigitalOcean Provider: Ensure you have your DigitalOcean API token configured in Pulumi.
  3. Create a new Pulumi Project: Initialize a new Pulumi project.

Pulumi Program in TypeScript

Below is the Pulumi program to achieve the deployment:

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
import * as k8s from "@pulumi/kubernetes";

// Create a DigitalOcean Kubernetes cluster
const cluster = new digitalocean.KubernetesCluster("my-cluster", {
    region: digitalocean.Region.NYC3,
    version: "1.21.5-do.0",
    nodePool: {
        name: "default",
        size: digitalocean.DropletSlug.DropletS1VCPU2GB,
        nodeCount: 3,
    },
});

// Export the cluster's kubeconfig
export const kubeconfig = cluster.kubeConfigs[0].rawConfig;

// Create a Kubernetes provider using the cluster's kubeconfig
const k8sProvider = new k8s.Provider("k8sProvider", {
    kubeconfig: kubeconfig,
});

// Deploy the zookeeper-3Nodes Helm chart
const zookeeperChart = new k8s.helm.v3.Release("zookeeper", {
    chart: "zookeeper",
    version: "3.6.3",
    repositoryOpts: {
        repo: "https://charts.bitnami.com/bitnami",
    },
    values: {
        replicaCount: 3,
    },
}, { provider: k8sProvider });

// Export the Helm release name
export const releaseName = zookeeperChart.name;

Explanation

  1. DigitalOcean Kubernetes Cluster:

    • We create a Kubernetes cluster named my-cluster in the NYC3 region.
    • The cluster uses Kubernetes version 1.21.5-do.0.
    • We define a node pool with 3 nodes, each of size s-1vcpu-2gb.
  2. Kubernetes Provider:

    • We create a Kubernetes provider using the kubeconfig from the created cluster. This allows us to interact with the Kubernetes cluster.
  3. Helm Release:

    • We deploy the zookeeper Helm chart from the Bitnami repository.
    • We specify the chart version 3.6.3 and set the replicaCount to 3 to create a 3-node ZooKeeper ensemble.

Running the Program

To deploy this infrastructure, follow these steps:

  1. Initialize Your Pulumi Project:

    pulumi new typescript
    
  2. Install Dependencies:

    npm install @pulumi/pulumi @pulumi/digitalocean @pulumi/kubernetes
    
  3. Run Pulumi Up:

    pulumi up
    

This will create the DigitalOcean Kubernetes cluster and deploy the zookeeper-3Nodes Helm chart. After the deployment, you can interact with your ZooKeeper cluster using the exported release name and kubeconfig.

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up