Deploy the tt-workflow helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the
tt-workflow
Helm chart on the Oracle Kubernetes Engine (OKE), we will use the Pulumi Kubernetes provider to interact with a Kubernetes cluster managed by OKE. Below, you'll find a detailed walkthrough and a Pulumi TypeScript program to automate the deployment process.Firstly, you would need to set up an Oracle Kubernetes Engine cluster. Once you have the cluster running, you will want to ensure that you have the necessary kubeconfig file that Pulumi will use to interact with your Kubernetes cluster.
Pulumi Kubernetes provider allows you to interact with Kubernetes resources, including deploying Helm charts. A Helm chart is a collection of pre-configured Kubernetes resources that can be managed as a single unit. The
kubernetes.helm.v3.Chart
class from the Pulumi Kubernetes SDK is used to deploy a Helm chart to your cluster.In the Pulumi program below, we assume you have already created an OKE cluster and have the kubeconfig file in place. We're going to deploy the
tt-workflow
Helm chart, which should be available in a Helm chart repository or as a package.Here is a step-by-step program that shows how to use Pulumi with TypeScript to deploy a Helm chart onto an OKE cluster:
import * as k8s from '@pulumi/kubernetes'; // Create a provider to interact with your OKE cluster. // Make sure your environment is configured with the kubeconfig of the OKE cluster. const k8sProvider = new k8s.Provider('oke-k8s', { kubeconfig: process.env.KUBECONFIG // This uses the KUBECONFIG environment variable }); // Deploy the `tt-workflow` Helm chart to the OKE cluster. // Replace `chartRepoUrl` with the URL of your Helm chart repository if applicable // and specify the version of the chart you want to deploy. const chart = new k8s.helm.v3.Chart('tt-workflow-chart', { chart: 'tt-workflow', // The name of the chart version: '1.0.0', // The version of the chart, specify the exact version you want to deploy fetchOpts: { repo: 'https://myhelmrepo.example.com/charts', // The repository where your chart is located }, // You can also specify additional configuration options for your Helm chart deployment. // values: { // key: "value", // } }, { provider: k8sProvider }); // Expose resources if necessary, for example an URL for a service with a LoadBalancer type export const ttWorkflowServiceUrl = chart.getResourceProperty('v1/Service', 'tt-workflow-service', 'status').apply(status => { return status.loadBalancer.ingress[0].ip; // Or `.hostname` depending on your cloud provider });
This program will deploy the
tt-workflow
Helm chart to your Oracle Kubernetes Engine cluster. Here's an explanation of what each part of the program is doing:-
The
@pulumi/kubernetes
package is imported to give us access to the Pulumi Kubernetes SDK. -
A Kubernetes Provider is created which gives Pulumi the means to communicate with your OKE cluster.
-
We create an instance of
Chart
which represents thett-workflow
Helm chart. Here, you need to specify the exact Helm chart name and version that you want to deploy. Additionally, you need to provide the URL to the repository where your chart is hosted (chartRepoUrl
). -
In the options for the Chart, you can provide a set of values to customize the chart parameters to suit your deployment specs (uncomment the values section if you need to provide custom values).
-
Finally, we have an optional export statement. This would be used to export a specific resource property from our deployment, for example, a service URL if we had a service that was exposed as a LoadBalancer.
Remember to set the
KUBECONFIG
environment variable to contain the path to your kubeconfig file before runningpulumi up
, so that Pulumi knows how to communicate with your cluster.Make sure you replace
https://myhelmrepo.example.com/charts
with the actual repository URL where thett-workflow
chart is hosted and update theversion
to match the version you wish to deploy.And that's pretty much it! Run
pulumi up
and watch Pulumi perform the deployment for you.-