1. Deploy the logstream-leader helm chart on Kubernetes


    To deploy the logstream-leader Helm chart on a Kubernetes cluster using Pulumi, we'll be utilizing the kubernetes.helm.v3.Chart resource. This resource allows you to deploy Helm charts into your Kubernetes cluster from a variety of sources such as a Helm repository or even from a local path.

    Here's how you do it:

    1. Import the Required Modules: You'll need the @pulumi/kubernetes module to use Kubernetes resources.

    2. Create a Helm Chart Resource: You instantiate a Chart resource from the @pulumi/kubernetes/helm/v3 module. You can specify the chart name, version, and repository or local path where the chart is located.

    3. Configure Chart Values: If the Helm chart accepts configuration values (often found in a values.yaml file when you look at Helm charts), you can override default settings by providing a values property.

    4. Deployment to Kubernetes: Pulumi will need access to your Kubernetes cluster's configuration, typically taken from your local kubeconfig file.

    5. Export Outputs: (Optional) Export any outputs from the Helm chart that you might need, such as service URLs or other statuses.

    Below is a Pulumi program written in TypeScript that demonstrates this process:

    import * as kubernetes from "@pulumi/kubernetes"; // Name of the Helm chart const chartName = "logstream-leader"; // Repository where the Helm chart is located. // Replace with the actual repository URL where `logstream-leader` is hosted. const chartRepo = "https://charts.example.com/"; // Optional: Specify the version of the chart you want to deploy. // If omitted, the latest version will be deployed. const chartVersion = "1.2.3"; // Replace with the actual chart version // Optional: The namespace where you want to deploy the Helm chart. // If not specified, it will use the default namespace. const namespace = "default"; // Adjust this to your preferred namespace. // Chart Values: Custom configuration for the Helm chart // Adjust these values based on the `logstream-leader` Helm chart's requirements. const chartValues = { // Example configuration values; these will vary depending on the chart. replicaCount: 2, service: { type: "LoadBalancer", }, // ... additional custom values ... }; // Create a Helm Chart resource using the `logstream-leader` chart from the specified repository const logstreamLeaderChart = new kubernetes.helm.v3.Chart(chartName, { chart: chartName, version: chartVersion, namespace: namespace, fetchOpts: { repo: chartRepo, }, values: chartValues, }); // Export the Helm chart's deployed service URL, if applicable // Replace `service_name` with the actual service exposed by `logstream-leader` export const serviceUrl = logstreamLeaderChart.getResourceProperty( "v1/Service", "<service_name>", "status" );

    In this program:

    • You would replace the placeholder values (chartRepo, chartVersion, etc.) with the actual values that are applicable to the logstream-leader Helm chart.
    • The logstreamLeaderChart is the instance of the Helm Chart you're deploying. It contains the configuration for deployment.

    Make sure to install the required Pulumi package for Kubernetes by running:

    npm install @pulumi/kubernetes

    You also need to ensure Pulumi is configured to have access to your Kubernetes cluster, which it typically does via your kubeconfig file. And remember, when you're ready to deploy the Helm chart, execute the commands:

    pulumi up

    This command will start the Pulumi deployment process which will show you a preview of the resources that will be created. Once you're ready, confirm the deployment to proceed and watch your Helm chart being deployed to your Kubernetes cluster.