Deploy the turbonomic-importer helm chart on Linode Kubernetes Engine
TypeScriptTo deploy a Helm chart on the Linode Kubernetes Engine (LKE) using Pulumi, we'll take the following steps:
- Set up the Pulumi Kubernetes provider to interact with your Kubernetes cluster.
- Deploy the Helm chart using the
Chart
resource from the@pulumi/kubernetes
package.
Assuming you already have a Kubernetes cluster running on LKE and your kubeconfig is set up correctly, the Pulumi code below will deploy the
turbonomic-importer
Helm chart into your cluster.Here's a step-by-step guide on how to write and understand the Pulumi program that achieves this:
Step 1: Set up the Pulumi Kubernetes Provider
Pulumi uses providers to interact with cloud resources. In this case, the Kubernetes provider allows Pulumi to manage Kubernetes resources, such as the deployment of Helm charts.
Step 2: Deploy the Helm Chart
We will use the
kubernetes.helm.v3.Chart
class from the Pulumi Kubernetes provider which represents a Helm chart in a Pulumi program. You will need to replace the placeholder forCHART_NAME
withturbonomic-importer
and specify any custom values you may need in thevalues
property.Now, let's write the Pulumi program:
import * as kubernetes from "@pulumi/kubernetes"; // Step 1: Set up the Kubernetes provider const clusterProvider = new kubernetes.Provider("lke-provider", { kubeconfig: "<YOUR_KUBECONFIG_CONTENTS>", // You can also use process.env.KUBECONFIG to reference the kubeconfig file path }); // Step 2: Deploy the Helm chart const chart = new kubernetes.helm.v3.Chart("turbonomic-importer-chart", { chart: "turbonomic-importer", // Suppose you're fetching this Helm chart from a Helm repo. Replace 'REPO_URL' with the actual repository URL. repositoryOpts: { repo: "REPO_URL", }, // Include any custom values required for the Turbonomic Importer chart here. // This is an example of setting a value; replace it with your actual values. values: { key: "value", }, }, { provider: clusterProvider }); // Optional: Export the Helm chart name and status export const chartName = chart.metadata.apply(m => m.name); export const chartStatus = chart.status.apply(s => s);
Replace
<YOUR_KUBECONFIG_CONTENTS>
with the actual kubeconfig contents that allow you to connect to your Linode Kubernetes cluster. If your kubeconfig is set as an environment variable or located in the default path (~/.kube/config
), Pulumi will automatically use it, and you can omit thekubeconfig
property.Replace
REPO_URL
with the URL of the Helm repository where theturbonomic-importer
chart is hosted. This could be a public or private repository.The
values
object is where you can specify configuration options that the chart accepts. Replace the examplekey: "value"
pair with any actual configuration options you need for theturbonomic-importer
chart.Once this code is set up, you can deploy the Helm chart by running the
pulumi up
command in your CLI.Keep in mind that Helm charts and their repositories are strictly version controlled, and you may want to lock the chart version by providing it in the arguments to prevent accidental updates.
The example uses TypeScript which needs to be compiled to JavaScript before execution. If you modify the program, make sure to compile it using
tsc
command or run it in a Pulumi project that handles compilation automatically.If you have not yet installed Pulumi or configured your Pulumi project, please refer to the Getting Started with Pulumi guide which provides detailed instructions on how to set up Pulumi for your cloud applications.