Deploy the k8s-spot-termination-handler helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the
k8s-spot-termination-handler
Helm chart on the Oracle Kubernetes Engine (OKE), you will need to first have a Kubernetes cluster running on OKE. I will assume you have this set up already. If not, you would need to use resources from theoci
package such asoci.ContainerEngine.Cluster
to provision an OKE cluster.Once your cluster is operational, you'll use Pulumi's
kubernetes
package to apply Helm charts to your Kubernetes cluster. Thekubernetes.helm.v3.Chart
resource from the Pulumikubernetes
provider allows you to deploy a Helm chart.Let's walk through the steps of writing a Pulumi program that deploys the
k8s-spot-termination-handler
Helm chart to an existing Kubernetes cluster managed by OKE:-
Prerequisites: Assume you have Pulumi installed, your cloud provider CLI configured (in this case, Oracle's OCI CLI) and that you are authenticated to your Kubernetes cluster.
-
Setting up Pulumi: You will start by importing the necessary Pulumi packages in your TypeScript program so that you can interact with Kubernetes resources.
-
Chart Deployment: You will then create an instance of the
Chart
resource to deploy thek8s-spot-termination-handler
Helm chart into your OKE cluster.
import * as k8s from "@pulumi/kubernetes"; const namespace = "default"; // Define the namespace in which to deploy the Helm chart // Deploy the k8s-spot-termination-handler Helm chart to the OKE cluster. const spotTerminationHandler = new k8s.helm.v3.Chart("k8s-spot-termination-handler", { chart: "k8s-spot-termination-handler", version: "1.0.0", // Replace with the correct chart version namespace: namespace, fetchOpts:{ repo: "https://example.com/helm/charts", // Replace with the actual Helm chart repository URL }, }); export const helmChartName = spotTerminationHandler.metadata.name;
Make sure to replace
"https://example.com/helm/charts"
with the actual repository URL where the Helm chart fork8s-spot-termination-handler
is hosted.- Running the Pulumi Program: To run this Pulumi program, you would typically use the Pulumi CLI with the following commands in your terminal:
pulumi up
This command will initiate the deployment process, where Pulumi will compute the expected state and planned changes and ask for your confirmation before modifying any resources in the cloud provider.
Please note, the program above assumes you have existing knowledge about your Kubernetes cluster setup on Oracle Kubernetes Engine, including namespace and Helm chart details. Make sure to replace placeholder strings like chart version and repository URL with accurate values from the Helm chart you aim to deploy.
-