Deploy the cloudcioperator helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the
cloudcioperator
Helm chart on Oracle Kubernetes Engine (OKE), we will perform a series of steps within a Pulumi program written in TypeScript. The program will define the necessary cloud infrastructure with Pulumi's infrastructure as code approach, including creating an Oracle Kubernetes Engine cluster (using theoci.ContainerEngine.Cluster
resource type) and deploying the Helm chart (using thekubernetes.helm.sh/v3.Chart
resource type from the Kubernetes provider).Here's a high-level overview of the steps we'll take:
- Create an instance of an OKE cluster where our applications will run.
- Once the cluster is provisioned, configure our Pulumi program to use the Kubernetes provider that connects to the created cluster.
- Deploy the
cloudcioperator
Helm chart onto the OKE cluster.
Below is the Pulumi program that accomplishes the above steps. Please note that some values, such as the compartment ID and other OCI-specific configurations, need to be replaced with actual values from your OCI account. These values are often sensitive and should be sourced from a secure location or the Pulumi configuration system, but for simplicity, we will hardcode them here:
import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // Replace the following placeholders with your actual OCI compartment, VCN, and subnet IDs const compartmentId = "ocid1.compartment.oc1..."; // OCI Compartment ID const vcnId = "ocid1.vcn.oc1..."; // OCI VCN ID const subnetIds = ["ocid1.subnet.oc1..."]; // Subnet IDs for OKE // Create an Oracle Kubernetes Engine (OKE) cluster const cluster = new oci.ContainerEngine.Cluster("myOkeCluster", { compartmentId: compartmentId, name: "cloudci-cluster", vcnId: vcnId, kubernetesVersion: "v1.21.0", options: { // ... additional options like networking, addons, etc. }, }); // Use Kubernetes provider to connect to the created OKE cluster const k8sProvider = new k8s.Provider("myK8sProvider", { kubeconfig: cluster.kubeconfig.content.apply(c => Buffer.from(c, "base64").toString("utf-8")), }); // Deploy the cloudcioperator Helm chart to the OKE cluster const cloudciOperatorChart = new k8s.helm.v3.Chart("cloudcioperator", { chart: "cloudcioperator", version: "1.0.0", // specify the version of the chart // repo: "http://example.com/helm-charts", // specify the Helm repository that hosts the cloudcioperator chart // values: { /* specify any custom values.yaml configurations here */ }, }, { provider: k8sProvider }); // Export the cluster's name and kubeconfig export const clusterName = cluster.name; export const kubeconfig = cluster.kubeconfig;
Here's a detailed review of the program:
- We start by importing the necessary Pulumi packages.
- We define the parameters such as compartment ID, VCN ID, and subnet IDs that will be used to configure the OKE cluster.
- We instantiate an OKE cluster with
oci.ContainerEngine.Cluster
. - We then create a Kubernetes provider instance by using the kubeconfig that is generated from the newly created OKE cluster.
- We deploy the
cloudcioperator
Helm chart by creating an instance ofk8s.helm.v3.Chart
. Here, you will need to replace theversion
with the version of Helm chart you want to deploy, and you might have to specify the Helm repository URL if the chart is hosted in a custom repository. - Finally, we export some of the output properties like the cluster's name and kubeconfig to easily connect to the cluster with
kubectl
.
Important Notes:
- The version (
v1.21.0
) specified in the creation of the OKE cluster should be compatible with your Helm chart and tailored to what Oracle Cloud Infrastructure (OCI) supports. - You must replace placeholder values with the actual IDs from your OCI account for the compartment, VCN, and subnet.
- The Helm chart version and repository (
version: "1.0.0"
andrepo: "http://example.com/helm-charts"
) are placeholders and should be replaced with the correct values of thecloudcioperator
chart.
When you've set up your OCI credentials and have Pulumi installed and configured, run the program with the following commands:
pulumi up
This will start the deployment process. Review the changes that Pulumi plans to make and confirm them to proceed with the actual deployment. After the deployment is complete, you will have the
cloudcioperator
Helm chart running on your OKE cluster.