Deploy the yace-exporter helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the
yace-exporter
Helm chart on Oracle Kubernetes Engine (OKE) using Pulumi, you need to complete several steps:- Set up an Oracle Kubernetes Engine (OKE) cluster if you don't already have one.
- Ensure you have
kubectl
configured to communicate with your OKE cluster. - Write a Pulumi program to deploy the
yace-exporter
Helm chart.
Below is a Pulumi TypeScript program that demonstrates how to deploy a Helm chart to an existing OKE cluster. This program assumes you already have an OCI (Oracle Cloud Infrastructure) Kubernetes cluster available and
kubectl
is set up to interact with that cluster.The program uses the
oci.ContainerEngine.Cluster
resource to represent your existing cluster. You use thekubernetes.helm.v3.Chart
resource from the@pulumi/kubernetes
package to represent the Helm chart deployment.Before you run the Pulumi program, ensure:
- You have Pulumi CLI installed and logged in to your account.
- You have the required OCI credentials for Pulumi to manage resources in your Oracle Cloud Infrastructure.
Here's the detailed Pulumi TypeScript program:
import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; // Retrieve an existing Kubernetes cluster managed by Oracle's Container Engine for Kubernetes (OKE). // Replace `<cluster-id>` with your actual cluster ID. const cluster = oci.ContainerEngine.Cluster.get("existing-cluster", "<cluster-id>"); // Pull OCI config to interact with the OKE cluster from Pulumi configuration // Store the kubeconfig information for your cluster, which should be securely retrieved from your infrastructure // For example purposes, we use a placeholder. Replace this with the kubeconfig content const kubeconfig = pulumi.output('<Insert your kubeconfig here>'); // Create a provider instance using the kubeconfig obtained from your OKE cluster const provider = new k8s.Provider("oke-k8s", { kubeconfig: kubeconfig, }); // Deploy the yace-exporter Helm chart const chart = new k8s.helm.v3.Chart("yace-exporter", { chart: "yace-exporter", version: "latest", // Specify the chart version you want to deploy. fetchOpts:{ repo: "https://<repository-url>", // Replace with the URL of the Helm repository containing the yace-exporter chart }, }, { provider: provider }); // Export the name of the chart export const chartName = chart.metadata.name;
This program does the following:
- Imports essential packages
@pulumi/pulumi
for the Pulumi core functionality and@pulumi/kubernetes
to interact with Kubernetes clusters and resources. - Retrieves information of an existing OKE cluster using the
oci.ContainerEngine.Cluster
resource. You need to provide the cluster ID. - Initializes a new Kubernetes provider to interact with the OKE cluster, using the kubeconfig from the Oracle Cloud.
- Deploys the
yace-exporter
Helm chart to the cluster using thek8s.helm.v3.Chart
resource. The name of the chart and the repository URL are placeholders in this code, and you need to replace them with the actual Helm chart name and the URL of the Helm repository.
After preparing the code above, execute it with the Pulumi CLI:
- Run
pulumi up
to preview and deploy the changes. - After examining the preview, if everything looks good, confirm the deployment by selecting
yes
.
Pulumi will then carry out the actions described in the program and deploy the Helm chart to your OKE cluster. You can manage and monitor the deployment through the Pulumi CLI or Pulumi Console.