1. Deploy the bff-vrecli-service helm chart on Rancher


    Deploying a Helm chart on a Rancher-managed cluster involves several steps, including setting up the Rancher provider, configuring the Kubernetes provider if the cluster is pre-existing, and finally deploying the Helm chart using Pulumi's Helm support.

    Below I'll provide you with a TypeScript program that uses Pulumi to deploy a Helm chart named bff-vrecli-service to a Rancher-managed Kubernetes cluster. I'll walk you through each step and explain what each part of the code does.

    Setting up the Pulumi Program

    First, you'll need to install the necessary Pulumi packages. Install them by running:

    npm install @pulumi/rancher2 @pulumi/kubernetes @pulumi/pulumi

    Explanation of Resources and Providers

    • rancher2.Cluster: This resource will be used if we need to provision a new Kubernetes cluster managed by Rancher, but for this example, we'll assume that the cluster already exists.
    • kubernetes.Provider: This is the Pulumi provider for Kubernetes, which allows Pulumi to interact with any Kubernetes cluster, including those managed by Rancher.
    • kubernetes.helm.v3.Chart: This Pulumi resource represents a Helm chart, which allows us to deploy packaged applications to Kubernetes.

    Example Pulumi TypeScript Program

    Below is the TypeScript program:

    import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; // Initialize the Pulumi Rancher2 provider. // Assuming you have already set up Rancher with Pulumi and have a kubeconfig file setup. // You would need to ensure the current context in kubeconfig is set to the Rancher-managed Kubernetes cluster. const k8sProvider = new k8s.Provider('rancher-k8s-provider', { kubeconfig: '<YOUR_KUBECONFIG_CONTENTS>', // Replace with actual kubeconfig contents or load from file }); // Deploy the bff-vrecli-service Helm chart to the Rancher-managed cluster. const helmChart = new k8s.helm.v3.Chart('bff-vrecli-service-chart', { // Specify the Helm chart repository options here chart: 'bff-vrecli-service', // Specify the version of the chart to install here version: '<CHART_VERSION>', // For instance, '1.2.3' // Specify any values that need to be overridden from the default chart values here values: { // Your value overrides here }, // Specify the namespace to deploy to or use default if none specified namespace: '<DEPLOY_NAMESPACE>', // Replace with the target namespace or omit if using 'default' }, { provider: k8sProvider }); // Export the Helm chart deployment's name export const helmChartName = helmChart.metadata.name;

    You'll need to replace placeholder values with the actual values you have.

    • <YOUR_KUBECONFIG_CONTENTS>: The contents of the kubeconfig file that grants access to your Rancher Kubernetes cluster. This information is crucial for Pulumi to be able to interact with the cluster.
    • <CHART_VERSION>: The version number of the Helm chart you want to deploy, e.g., 1.0.0.
    • <DEPLOY_NAMESPACE>: The Kubernetes namespace where you want your Helm chart to be deployed; if it's not provided, it defaults to the default namespace.

    The code will create a new instance of the Kubernetes provider pointing to your Rancher cluster, and then it will use that provider to deploy the Helm chart by creating a Chart resource with the specified settings.

    Exporting Deployment Details

    At the end of the program, there is an export statement. This line makes the name of the Helm chart deployment available to the Pulumi CLI after deployment, allowing you to see and reference the deployment's name outside of the program directly.

    After you set up the code with your values, run it using the Pulumi CLI:

    pulumi up

    This command starts the deployment process, and Pulumi will show you a preview of the resources that will be created. If everything looks correct, confirm the deployment to proceed.


    This program sets up a connection with a Rancher-managed Kubernetes cluster using Pulumi's Kubernetes provider and then deploys a Helm chart to that cluster. By modifying the values in the code, you can customize the deployment to fit your specific needs.

    Remember to always review your kubeconfig and other sensitive details to ensure they're correct and that they're being handled securely.