1. How to upload Helm chart to GCP with Pulumi?

    TypeScript

    You can use the Pulumi Kubernetes provider to deploy a Helm chart to a Kubernetes cluster on Google Cloud Platform (GCP). Here's a code that creates a Kubernetes Namespace and deploys a sample Nginx chart from the Bitnami Helm repository.

    Firstly, create a Kubernetes namespace where the Helm chart will be deployed:

    import * as k8s from "@pulumi/kubernetes"; const namespace = new k8s.core.v1.Namespace("test-namespace", {});

    Then deploy the Helm chart:

    import * as k8s from "@pulumi/kubernetes"; const nginx = new k8s.helm.v3.Chart("nginx", { repo: "bitnami", chart: "nginx", version: "9.3.2", namespace: namespace.metadata.name, });
    • The resources above use the Kubernetes and Helm providers to deploy Helm charts.
    • We are creating a new namespace with k8s.core.v1.Namespace that will be used to scope our nginx deployment.
    • Then, we are deploying an nginx Helm chart using new k8s.helm.v3.Chart. We specify bitnami as the repository, nginx as the chart, and 9.3.2 as the version.

    Lastly, export the desired outputs:

    import * as pulumi from "@pulumi/pulumi"; export const namespaceName = namespace.metadata.name; export const nginxVersion = pulumi.output("9.3.2");

    For complete Pulumi code:

    import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create a Namespace const namespace = new k8s.core.v1.Namespace("test-namespace", {}); // Deploy the Helm chart const nginx = new k8s.helm.v3.Chart("nginx", { repo: "bitnami", chart: "nginx", version: "9.3.2", namespace: namespace.metadata.name, }); // Export the Namespace name export const namespaceName = namespace.metadata.name; export const nginxVersion = pulumi.output("9.3.2");

    Link to Documentation

    Please note that you need to have a GCP Kubernetes cluster in place and setup kubeconfig correctly for your Pulumi package to have the right access for deployment.