Deploy the yadms helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy a Helm chart on the Oracle Kubernetes Engine (OKE) using Pulumi, you'll need to take the following high-level steps:
- Set up a Kubernetes cluster within the Oracle Cloud Infrastructure (OCI).
- Configure
kubectl
and your local machine to communicate with the OKE cluster. - Deploy the Helm chart to your OKE cluster.
For the purpose of this explanation, I will assume the Oracle Kubernetes cluster is already running and you have the necessary credentials to access it. We will focus on steps 3, deploying the Helm chart, as steps 1 and 2 are typically done once for the cluster setup and involve actions outside the scope of a typical Pulumi program, such as configuring your local environment.
We'll utilize the Pulumi Kubernetes provider to deploy the Helm chart. The
kubernetes.helm.v3.Chart
resource enables you to describe a Helm chart's release in Pulumi's infrastructure as code.Below is a Pulumi TypeScript program that demonstrates how to use the
Chart
resource to deploy a Helm chart on a pre-existing OKE cluster:import * as pulumi from "@pulumi/pulumi"; import * as kubernetes from "@pulumi/kubernetes"; // Create a provider to connect to the existing Oracle Kubernetes Engine (OKE) cluster. // Replace the kubeconfig placeholder with the actual kubeconfig content from your OKE cluster. const provider = new kubernetes.Provider("oke-provider", { kubeconfig: "<YOUR_KUBECONFIG_HERE>", }); // Deploy the `yadms` chart into the `default` namespace using the Helm Chart resource. const chart = new kubernetes.helm.v3.Chart("yadms-chart", { chart: "yadms", // The repository URL where the chart is hosted. // Replace this with the correct URL for the yadms chart. repo: "https://charts.example.com/", // Optionally, you can specify the chart version to deploy. // version: "1.2.3", // You can provide a set of values to customize the deployment if needed. // values: { // key: "value", // }, }, { provider }); // Export the status URL of the deployed application. // This assumes the chart creates an endpoint that's accessible from outside. // Modify accordingly if the Helm chart exposes URLs differently. export const applicationUrl = chart.getResourceProperty("v1/Service", "yadms-service", "status").apply(status => status.loadBalancer.ingress[0].hostname);
In this program, you first create a Kubernetes provider configured with the kubeconfig of your Oracle Kubernetes Engine (OKE) cluster. This provider is used to interact with the cluster.
Next, you declare a
Chart
resource representing the deployment of theyadms
Helm chart. You need to replace the placeholderrepo
URL with the actual URL of the Helm chart repository whereyadms
is hosted. If needed, you can also specify the version of the Helm chart you desire to deploy and provide any custom values via thevalues
field to override the default settings from the chart.Finally, you export the URL of your application. This assumes that the
yadms
Helm chart creates a KubernetesService
with typeLoadBalancer
, which would then allocate a public IP or hostname. ThegetResourceProperty
function is used to retrieve thestatus.loadBalancer.ingress[0].hostname
property of this service.Be aware that you need to replace placeholder values (such as
<YOUR_KUBECONFIG_HERE>
or Helm chart repository URLs) with the actual values relevant to your deployment.Please note that I demonstrated the Pulumi part of the deployment assuming that the networking and access role setups are already complete. Handling OCI specifics to provision OKE clusters or configure the required Identity and Access Management (IAM) policies can further extend this program.
Before running this Pulumi program, you must have Pulumi CLI installed and be authenticated with the Oracle Cloud. You can run the Pulumi program using the following CLI commands:
pulumi stack init dev # Initializes a new Pulumi stack called 'dev' pulumi up # Preview and deploy changes
After running
pulumi up
, Pulumi performs the deployment of the Helm chart to your OKE cluster. Each resource managed by Pulumi will be shown in the CLI output, and you can confirm the deployment to proceed.To learn more about the
kubernetes.helm.v3.Chart
resource, visit the Pulumi Kubernetes provider documentation.