Deploy the zookeeper-helm-chart helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy a Helm chart on the Oracle Kubernetes Engine (OKE), you can use Pulumi with the Kubernetes provider. Pulumi's Kubernetes provider allows us to manage Kubernetes resources, including the deployment of Helm charts.
The Helm Chart resource in Pulumi enables you to deploy existing Helm charts into a Kubernetes cluster. Pulumi interacts with Helm's Tiller service to deploy the chart.
Firstly, you would need to set up your Oracle Kubernetes Engine and configure your
kubeconfig
so thatkubectl
and Pulumi can interact with it. Assuming you already have an OKE cluster set up and your kubeconfig is configured, the following TypeScript program illustrates how to deploy thezookeeper
Helm chart on OKE using Pulumi.Here's a step-by-step explanation of the code:
-
Import necessary modules from Pulumi and define your Pulumi program within the
pulumi.all
block. -
Create a new Helm Chart resource. The
kubernetes.helm.v3.Chart
class enables you to specify the Helm chart repository URL and the chart name, alongside any configurable values you may want to provide to the chart. -
Finally, we'll perform an export of the Chart's resources to confirm the deployment through Pulumi CLI output.
Below is the TypeScript program that performs these actions:
import * as pulumi from "@pulumi/pulumi"; import * as kubernetes from "@pulumi/kubernetes"; // Zookeeper Helm chart configuration const zookeeperChart = new kubernetes.helm.v3.Chart("zookeeper", { chart: "zookeeper", version: "5.19.2", // Specify the version of the chart you want to deploy fetchOpts: { repo: "https://charts.bitnami.com/bitnami", // URL to the chart repository }, // Add any custom values here, for example, replicaCount or persistence settings. values: { replicaCount: 3, }, }, {provider: new kubernetes.Provider("oke-k8s-provider", { // Ensure that the kubeconfig property is pointing to your OKE cluster's kubeconfig kubeconfig: "<YOUR_OKE_KUBECONFIG>", }), }); // Export the resources of the Helm chart export const chartResources = zookeeperChart.resources;
Please replace
<YOUR_OKE_KUBECONFIG>
with the actual kubeconfig for your OKE cluster. It might typically be stored in a file, but for best practices, you should use a Pulumi configuration secret or some secure storage mechanism to handle the kubeconfig data.Remember, the above code should be used within the context of a Pulumi program. To run this program:
-
Ensure you have the Pulumi CLI installed.
-
Create a new Pulumi TypeScript project.
-
Install the required NPM packages:
npm install @pulumi/pulumi @pulumi/kubernetes
-
Paste the program code above into your
index.ts
file in the project. -
Run
pulumi up
to preview and deploy the resources.
Pulumi will provide the detailed output, summarizing the planned actions, resources it will create, modify, or replace, and after confirmation, will apply the changes accordingly. Upon successful completion, you will see the exported chart resources, indicating that Zookeeper has been deployed onto your OKE cluster.
-