Deploy the content-store helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy a Helm chart to Oracle Kubernetes Engine (OKE) using Pulumi, we'll have to take several steps. We'll set up an OKE instance, publish the Docker image to the Oracle Container Registry, and then deploy the Helm chart to our Kubernetes cluster.
First, you'll need to have Pulumi and the Oracle Cloud Infrastructure (OCI) CLI set up and authenticated on your machine.
Here's how you can use Pulumi to deploy the
content-store
Helm chart to OKE:- Setting up the Oracle Kubernetes Engine: We will create an OKE cluster using
oci.ContainerEngine.Cluster
resource. - Publishing the Docker Image: Optionally, if you need to publish your Docker images to Oracle Container Registry, use the
oci.Artifacts.ContainerRepository
resource. - Deploying the Helm Chart: We will deploy the Helm chart using Pulumi’s
kubernetes.helm.v3.Chart
resource, which allows us to interact with Helm charts.
Below is the Pulumi program written in TypeScript. This program is meant to be a blueprint. Note that actual values such as compartment IDs, VCN IDs, subnet IDs, and Kubernetes version need to be replaced with real values from your OCI environment.
import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Set up the OKE cluster const cluster = new oci.containerengine.Cluster("my-cluster", { /* You need to replace the compartmentId with your actual compartment ID */ compartmentId: "ocid1.compartment.oc1..your_compartment_id", /* You need to specify the Kubernetes version you want to use */ kubernetesVersion: "v1.21.5", /* The VCN in which the OKE cluster and its node pools will be created */ vcnId: "ocid1.vcn.oc1..your_vcn_id", options: { /* Addons like Tiller and Kubernetes Dashboard can be enabled here */ addOns: { isKubernetesDashboardEnabled: false, isTillerEnabled: false }, /* Network settings for services and pods */ kubernetesNetworkConfig: { podsCidr: "10.244.0.0/16", servicesCidr: "10.96.0.0/16" }, /* Other OKE options */ } }, { dependsOn: [/* any dependencies, if necessary */] }); // Once your cluster is created, you need to configure kubectl to point to this new cluster // This is typically done via `oci ce cluster create-kubeconfig` locally, which you will need to do to obtain the kubeconfig file. // Step 2: Publishing Docker images if necessary would go here (omitted for this guide). // Step 3: Deploy the Helm chart to our Kubernetes cluster const myChart = new k8s.helm.v3.Chart("my-helm-chart", { chart: "content-store", /* The repository of your helm chart, change it to point to where your Helm chart is */ fetchOpts: { repo: "https://charts.example.com/" }, /* Value overrides for the Helm chart */ values: { // Define your helm chart values here, which will override default values of the Helm chart }, /* Specify the namespace if required, default is `default` */ namespace: "default", }, { provider: "the-k8s-provider-you-set-up-for-your-OKE-cluster" }); // Export the public IP to access the content-store (if applicable) export const contentStorePublicIp = myChart.getResourceProperty("v1/Service", "content-store", "status").apply(status => status.loadBalancer.ingress[0].ip);
Please remember to replace placeholders such as
your_compartment_id
,your_vnc_id
, the repository URL, and any additional chart values you need to overwrite before running the program.For the
contentStorePublicIp
to work, your Helm chart must include a Service of typeLoadBalancer
, and your cluster needs to support Load Balancer services.Before running the program, you should configure Pulumi to use your desired TypeScript settings. Once you have your Pulumi project configured, you can deploy this program with the
pulumi up
command.This program creates resources in Oracle Cloud Infrastructure and deploys a Helm chart that should be accessible at the outputted public IP address after successful deployment. Make sure to follow Oracle's security and networking best practices when deploying resources.
- Setting up the Oracle Kubernetes Engine: We will create an OKE cluster using