Deploy the kubeclarity helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptDeploying a Helm chart to a Kubernetes cluster managed by Oracle Kubernetes Engine (OKE) involves several steps with Pulumi. In this setup, you'll need to:
- Configure the OCI provider to manage resources in Oracle Cloud.
- Create or use an existing OKE Kubernetes cluster.
- Set up the Kubernetes provider to deploy resources to the OKE cluster.
- Deploy the kubeclarity Helm chart to the OKE cluster.
First, make sure you have the appropriate Pulumi CLI installed and OCI configured on your machine. Your credentials must be set up, and the appropriate policy to allow a user to manage Kubernetes clusters must be in place.
The program below demonstrates how to deploy the kubeclarity Helm chart to OKE using Pulumi. The
oci.ContainerEngine.Cluster
resource is used to represent an OKE cluster, and thekubernetes.helm.v3.Chart
resource is used to deploy the Helm chart into the cluster.Here's a detailed TypeScript program to accomplish this:
import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Configure the OCI provider to interact with your Oracle Cloud Infrastructure // Ensure that your OCI configuration is set up correctly on your system. // Step 2: Reference an existing OKE cluster or create a new one // For the purposes of this example, we'll assume you have already set up an OKE cluster // and have its details like OCID and Kubeconfig file available. // Replace 'OKE_CLUSTER_OCID' with your actual cluster OCID. const okeCluster = oci.containerengine.Cluster.get("okeCluster", "OKE_CLUSTER_OCID"); // Step 3: Use the Kubeconfig of the OKE cluster to configure the Kubernetes provider. // Replace the 'kubeconfigPath' with the actual path to your cluster's kubeconfig file. const k8sProvider = new k8s.Provider("okeK8s", { kubeconfig: pulumi.output(okeCluster.kubeconfig).apply(kubeconfig => kubeconfig.content), }); // Step 4: Deploy the kubeclarity Helm chart on your OKE cluster using the kubernetes.helm.v3.Chart resource. const kubeclarityChart = new k8s.helm.v3.Chart("kubeclarity", { chart: "kubeclarity", // Replace this with the actual Helm repository that contains the kubeclarity chart fetchOpts: { repo: "https://helm-repository-containing-kubeclarity/", }, }, { provider: k8sProvider }); // Export the URL for the deployed application export const kubeclarityUrl = pulumi.interpolate`http://kubeclarity.${okeCluster.kubernetesCluster.endpoint}/`;
In this code:
- We import the required Pulumi packages for OCI, Kubernetes, and the core Pulumi API.
- We use the OCI provider to interact with Oracle Cloud Infrastructure. We assume that you've set up the OCI configuration in your environment.
- We reference an existing OKE cluster by its OCID. The OCID can be obtained from the Oracle Cloud console.
- We set up the Kubernetes provider using the kubeconfig of the OKE cluster. Usually, the kubeconfig is downloaded from the Oracle Cloud console or obtained via the OCI CLI.
- We deploy the kubeclarity Helm chart using a
Chart
resource. Make sure to replace therepo
option with the URL of the Helm repository that hosts the kubeclarity chart. - Finally, we export the URL where kubeclarity is accessible, which assumes a service of kubeclarity is exposed on the default HTTP port.
Make sure to replace the placeholder variables (
OKE_CLUSTER_OCID
,https://helm-repository-containing-kubeclarity/
) with actual values from your environment.To run this Pulumi program:
- Save the code to a file named
index.ts
. - Ensure your working directory contains a valid Pulumi project.
- Run
pulumi up
to preview and deploy the changes. Pulumi will show you a preview and prompt you to proceed with the deployment.