Deploy the ipa helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the IPA Helm chart on Oracle Kubernetes Engine (OKE) using Pulumi, we would need to perform several steps:
- Set up the OKE cluster where the Helm chart will be deployed.
- Configure our Pulumi environment to interact with Oracle Cloud Infrastructure (OCI).
- Use the Pulumi Kubernetes provider to deploy the Helm chart.
Below is a program written in TypeScript that illustrates how to deploy a Helm chart to an existing OKE cluster with Pulumi.
This program assumes that the Oracle Kubernetes Engine cluster already exists and you have the
kubeconfig
file that allows you to interact with the cluster. We are going to use thekubernetes.helm.v3.Chart
resource, which represents a Helm chart for deployment into the Kubernetes cluster.The
kubernetes
Pulumi package allows us to deploy and manage Kubernetes resources using Pulumi, including deploying Helm charts. TheChart
resource is particularly useful for this as it can deploy a Helm chart from various sources such as a Helm repo, a local directory, or even a tarball.Make sure you have Pulumi installed, and you are logged in to your Pulumi account before running this program. Pulumi will use your local
kubeconfig
file to interact with the OKE cluster. You can override which kubeconfig to use by setting theKUBECONFIG
environmental variable.Here's the Pulumi program that deploys an IPA Helm chart to your OKE cluster:
import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Configuration variables for the Helm chart. const ipaChartName = "ipa"; const ipaChartVersion = "x.x.x"; // Replace with the actual chart version const ipaReleaseName = "my-ipa-release"; const ipaNamespace = "default"; // The namespace for deploying the IPA chart. Replace with your namespace if different. // Initialize a Kubernetes provider that uses your kubeconfig from Oracle Kubernetes Engine. const k8sProvider = new k8s.Provider("oke-k8s", { kubeconfig: pulumi.output(process.env.KUBECONFIG).apply(JSON.stringify), }); // Deploy the IPA Helm chart. const ipaChart = new k8s.helm.v3.Chart(ipaReleaseName, { chart: ipaChartName, version: ipaChartVersion, namespace: ipaNamespace, // Values to override in the IPA Helm chart. values: { // Specify any custom values you want to override here. }, }, { provider: k8sProvider }); // Export the base URL for the IPA service once it is up and running. export const ipaServiceUrl = ipaChart.getResourceProperty("v1/Service", `${ipaNamespace}/${ipaReleaseName}`, "status").apply(status => { const loadBalancer = status.loadBalancer; const ingress = loadBalancer.ingress[0]; return ingress.hostname || ingress.ip; });
Explanation:
- We start by importing the necessary Pulumi libraries.
- We then set up configuration variables to specify the chart details and where it will be deployed.
- We initialize a Kubernetes provider to interact with OKE. The provider uses the kubeconfig pulled from
process.env.KUBECONFIG
, which should point to your OKE cluster's kubeconfig file. - We deploy the Helm chart using the
k8s.helm.v3.Chart
resource, which creates a new Helm release with the given name. - Inside the
values
property of the Chart arguments, you can override default values defined in the Helm chart by providing your own values. - Finally, we export the IPA service URL as a stack export, which will be the URL you use to interact with your deployed IPA application.
Make sure to replace
ipaChartVersion
with the actual version of the IPA Helm chart you want to deploy.This program should be part of a Pulumi project with the necessary
Pulumi.yaml
andpackage.json
files. You'll need to perform apulumi up
to preview and deploy the changes to your OKE cluster.