Deploy the workshop-operator helm chart on Kubernetes
TypeScriptTo deploy the
workshop-operator
Helm chart on a Kubernetes cluster using Pulumi, we will proceed with the following steps:- Set up the Pulumi Kubernetes Provider: This provider allows us to interact with Kubernetes clusters.
- Deploy a Helm Chart: We will use the
Chart
resource from the@pulumi/kubernetes
package, which allows us to deploy Helm charts to Kubernetes.
Below is a TypeScript program for Pulumi that accomplishes the goal:
import * as k8s from "@pulumi/kubernetes"; // Step 1: Configure the Kubernetes provider if necessary. // If your Kubernetes configuration is not at the default location (~/.kube/config), // you need to point the provider to the correct config context. const provider = new k8s.Provider("k8s-provider", { // If needed, specify the kubeconfig context here: // kubeconfig: ... }); // Step 2: Deploy the workshop-operator Helm chart. const workshopOperatorChart = new k8s.helm.v3.Chart("workshop-operator", { chart: "workshop-operator", // The name of the chart. version: "x.y.z", // Replace with the specific chart version you need. fetchOpts: { repo: "http://charts.your-org.com", // Replace with the Helm chart repository URL. }, // You can specify the values for chart configuration similar to how you use "values.yaml". // For example: // values: { // key: "value", // // ... // }, }, { provider: provider }); // Optional: If you want to export the status of the Helm release export const workshopOperatorStatus = workshopOperatorChart.status;
Here's what each step in the program does:
- The
k8s.Provider
instance is configured. If you're using a non-default Kubernetes configuration file or context, you have to specify it here. If you're working with a cloud-managed Kubernetes cluster (like EKS, AKS, or GKE) and have already set up the context forkubectl
, you might not need to specify the provider configuration. - The
k8s.helm.v3.Chart
resource instance is created to deploy the Helm chart. You must provide the chart name (workshop-operator
) and the chart version. Ensure that therepo
field is pointed at the correct Helm chart repository whereworkshop-operator
is hosted. If you have specific values that need to be applied to the chart, you can include avalues
property analogous to the Helm'svalues.yaml
file content.
Following these steps, you'll have deployed the
workshop-operator
on your Kubernetes cluster using Pulumi. Remember that you'll need the Helm chart's repository and version number to deploy it correctly.Pulumi will automatically track the status of the Helm deployment, and you can check the output of the deployment by using the
pulumi up
command. The optional exportedworkshopOperatorStatus
at the end can be used to retrieve the status of the Helm release programmatically for further inspections or integrations.