1. Deploy the k3s-janitor helm chart on Linode Kubernetes Engine


    To deploy a Helm chart on a Kubernetes cluster managed by the Linode Kubernetes Engine (LKE) using Pulumi, we'll use the following resources:

    • kubernetes.helm.v3.Chart: This Pulumi resource is responsible for deploying a Helm chart into a Kubernetes cluster. A Helm chart contains pre-configured Kubernetes resources that are ready to be installed with Helm, which is a package manager tool for Kubernetes.

    Here is the general process we will follow:

    1. Ensure you have a Kubernetes cluster running on LKE and that you have the kubeconfig file which allows you to interact with your cluster. Pulumi needs this file to authenticate against your cluster.

    2. Use the kubernetes.helm.v3.Chart resource to specify the k3s-janitor Helm chart that you want to deploy. This resource will need the name of the Helm chart, optionally the specific version you want to install, and any custom values you want to specify for your Helm chart configuration.

    3. Run the Pulumi program to perform the actual deployment.

    Before you begin, install the Pulumi CLI and authenticate with Linode if you haven't already done so, because you'll need a running LKE cluster to work against. Ensure you have kubectl installed and configured with the kubeconfig from Linode to interact with your LKE cluster. Also, make sure you're logged in to Pulumi with pulumi login.

    Now let's dive into the Pulumi program written in TypeScript:

    import * as k8s from '@pulumi/kubernetes'; // Provide the name of your Linode Kubernetes Engine cluster const clusterName = "my-lke-cluster"; // You should have the kubeconfig file ready for the cluster in order to use it with Pulumi const kubeconfig = `path-to-your-kubeconfig-file`; // Instantiate the Kubernetes provider using the kubeconfig obtained from Linode. const provider = new k8s.Provider(clusterName, { kubeconfig: kubeconfig, }); // Deploy the k3s-janitor Helm chart const k3sJanitorChart = new k8s.helm.v3.Chart('k3s-janitor', { chart: 'k3s-janitor', // Specify the Helm chart repository URL if it's not in the default Helm repo fetchOpts: { repo: "https://helm-repo/url/where/chart/is/located", }, // If there are any custom values you want to override in the Helm chart, specify them here. // values: { // someKey: 'someValue', // anotherKey: { // nestedKey: 'nestedValue' // } // }, }, { provider: provider }); // Export the name of the cluster export const cluster = clusterName;

    Replace path-to-your-kubeconfig-file with the path to your Linode kubeconfig file. If your Helm chart has dependencies that are not stored in the default repository or requires specific version, you must use the fetchOpts option to specify the repository URL.

    This program creates an instance of the Kubernetes provider linked to your LKE cluster through the specified kubeconfig. It then declares a Helm chart resource that reflects the k3s-janitor chart to be deployed within your LKE cluster.

    After setting up this Pulumi program:

    1. Run pulumi up in the terminal where your Pulumi project is defined.
    2. This will show you a preview of what Pulumi is about to do. Once you're ready, confirm the action, and Pulumi will execute the deployment.
    3. After completion, it will show you the status of the deployment and any stack exports you've defined, in this case, the name of the cluster.

    Keep in mind that some Helm charts might need additional configuration which you can provide in the values field.

    For more information about using Helm with Pulumi you can visit the Pulumi Kubernetes Helm documentation.