1. Deploy the tekton-demo helm chart on Kubernetes


    Deploying a Helm chart on a Kubernetes cluster with Pulumi involves declaring resources in your Pulumi code that correspond to the chart itself and any necessary Kubernetes cluster and namespace setup. Below is a step-by-step guide and the corresponding TypeScript program that demonstrates how to deploy the "tekton-demo" Helm chart into a Kubernetes cluster using Pulumi.


    Before running the Pulumi code, you'll need to ensure you have the following prerequisites met:

    • A configured Kubernetes cluster and kubeconfig file that provides access to the cluster. This may need to be specified in the Pulumi program or be available in the default location (~/.kube/config).
    • Pulumi CLI installed and set up to manage resources in your cluster.
    • Node.js and npm/yarn installed to run the TypeScript program.

    Program Explanation

    The program will use the kubernetes.helm.v3.Chart resource from the @pulumi/kubernetes package. This resource represents a Helm chart in declarative Pulumi code.

    Here's what each part of the program does:

    • Import statements: We are importing necessary Pulumi libraries.
    • Chart resource: We create an instance of Chart which represents the Helm chart we want to deploy.
    • Helm chart properties: We specify the chart name (chart), the repository where the chart can be found (repo), and any additional configuration values you might want to apply (values).
    • Namespace resource (optional): If you wish to deploy the Helm chart into a specific namespace, this resource should be declared and referenced in the chart resource.

    The Pulumi TypeScript Program

    import * as k8s from "@pulumi/kubernetes"; // (Optional) If you're deploying into a specific namespace, create it using a k8s.core.v1.Namespace resource. const namespace = new k8s.core.v1.Namespace("tekton-demo-ns", { metadata: { name: "tekton-demo" }, }); // Deploy the "tekton-demo" Helm chart. const tektonChart = new k8s.helm.v3.Chart("tekton-demo", { // Your chart configuration goes here: chart: "tekton-demo", version: "0.1.0", // Specify the chart version you wish to deploy fetchOpts: { repo: "https://charts.tekton.dev", // Chart repository URL }, namespace: namespace.metadata.name, // Specify the namespace created above // values: { /* ... Your custom values ... */ }, // Uncomment and replace with your values (if necessary) }); // Export the chart name, and any other outputs you wish to view export const chartName = tektonChart.metadata.name;

    Running the Pulumi Program

    After writing the TypeScript program into a file (usually named index.ts), run the following commands to deploy your resources:

    1. Install dependencies: Run npm install to install the necessary node modules specified in your package.json (which needs to include @pulumi/kubernetes).
    2. Preview changes: Run pulumi preview to get a preview of the operations that Pulumi will perform.
    3. Deploy resources: Run pulumi up to deploy the resources in your program. Pulumi will show you a summary of the planned changes and prompt you to confirm them before proceeding.

    When you're done, you can use pulumi destroy to tear down all resources managed by your Pulumi program.


    • You must customize the chart and version to match the specific Helm chart you wish to install if "tekton-demo" is not the actual chart name or if you have a different version in mind.
    • If you do not need to deploy to a specific namespace, you can remove the namespace resource and the namespace property from the chart resource.
    • Additional chart configuration values may be necessary depending on the Helm chart requirements. You can specify these in the values property of the Chart resource.

    Remember that Helm charts are often community-maintained and may have various configuration options you'll need to be aware of for proper deployment. Always review the chart's documentation prior to deployment.