Deploy the rabbitmq-producer-randomizer helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the
rabbitmq-producer-randomizer
Helm chart on Oracle Kubernetes Engine (OKE), you will need to set up a Kubernetes cluster on OKE, ensure that Helm is available to interact with the cluster, and then use Pulumi's Kubernetes provider to deploy the Helm chart.Below is a Pulumi program that demonstrates how to accomplish these steps. The program assumes that you have already set up the necessary Oracle Cloud Infrastructure (OCI) credentials and the Pulumi CLI installed and configured on your computer.
-
Create a new Cluster: We use the
oci.ContainerEngine.Cluster
resource to create a new OKE cluster. This cluster will give us a Kubernetes environment to deploy the Helm chart. -
Deploy the Helm Chart: Once we have the Kubernetes cluster available, we can deploy the
rabbitmq-producer-randomizer
Helm chart using thekubernetes.helm.v3.Chart
resource. This resource allows you to specify the location of the Helm chart, any values you want to override in the Helm chart, and other configurations.
Here is the complete Pulumi TypeScript program:
import * as pulumi from '@pulumi/pulumi'; import * as oci from '@pulumi/oci'; import * as k8s from '@pulumi/kubernetes'; // Create an OCI Kubernetes Engine Cluster const cluster = new oci.ContainerEngine.Cluster('oke-cluster', { // Provide required OKE cluster details here compartmentId: pulumi.interpolate`${your_compartment_id}`, kubernetesVersion: 'v1.18.10', // specify the version you want to use name: 'rabbitmq-cluster', // Add other necessary configurations like VCN, node pools, etc. }); // Once the cluster is created, we fetch its kubeconfig const kubeconfig = pulumi.all([cluster.id]).apply(([clusterId]) => { return oci.containerEngine.getClusterKubeconfig({ clusterId: clusterId, }); }); // Create a Kubernetes provider that uses the obtained kubeconfig const k8sProvider = new k8s.Provider('oke-k8s', { kubeconfig: kubeconfig.content, }); // Deploy the rabbitmq-producer-randomizer Helm chart on the cluster const rabbitmqChart = new k8s.helm.v3.Chart('rabbitmq-producer-randomizer-chart', { chart: 'rabbitmq-producer-randomizer', // Specify the Helm repository here if the chart is not from stable fetchOpts: { repo: 'http://your-helm-chart-repo/', }, values: { // Specify any values you want to override here }, }, { provider: k8sProvider }); // Export the cluster's kubeconfig to be able to interact with it using kubectl export const kubeconfigOutput = kubeconfig;
In this program:
your_compartment_id
should be replaced with the compartment ID within OCI where you want the OKE cluster to reside.- The OKE cluster is being initialized with a specific Kubernetes version. Ensure to use a supported version for the OKE.
- Adjust other configurations such as the node pool and network settings as necessary for your environment.
- The Helm repository URL (
http://your-helm-chart-repo/
) should be replaced with the URL of the repository where therabbitmq-producer-randomizer
Helm chart is hosted. - The
values
field withinrabbitmqChart
is where you can override default chart values if needed.
Remember to provide the actual values for the placeholders (
your_compartment_id
andhttp://your-helm-chart-repo/
) based on your environment and the Helm chart you are using.After writing this program in a file (e.g.,
index.ts
), run it with Pulumi using the usual commandspulumi up
to provision the resources. Make sure you have selected the appropriate Pulumi stack that corresponds to the environment you're targeting.-