1. Deploy the label-studio helm chart on Kubernetes

    TypeScript

    In order to deploy the Label Studio Helm chart on a Kubernetes cluster using Pulumi, you would typically follow these steps:

    1. Set up your Kubernetes cluster: You need a running Kubernetes cluster. The cluster can be on any cloud provider like AWS, Azure, or GCP, or it can be a local one like minikube or kind. Ensure you have kubectl access to this cluster and it is configured as the current context in your Kubernetes config file (~/.kube/config).
    2. Identify the Helm chart details: Determine the Helm chart repository where the Label Studio chart is hosted and the specific version of the chart that you want to deploy. Also, prepare any custom configuration values you wish to apply.
    3. Create a Pulumi program to deploy the chart: This involves writing a Pulumi program in TypeScript that will utilize the @pulumi/kubernetes package to deploy the Helm chart to your Kubernetes cluster.

    Let's walk through the construction of the Pulumi program.

    Prerequisites

    • Install Pulumi CLI and setup your Pulumi account.
    • Configure access to your Kubernetes cluster.
    • Know the Label Studio Helm chart's repository, chart name, and version.

    Detailed Steps

    1. Import Necessary Libraries: We'll start by importing the necessary Pulumi and Kubernetes libraries.

    2. Create a Kubernetes Provider: Instantiate a Kubernetes provider that uses the current context from your local kubeconfig file.

    3. Deploy the Chart:

      • Define a Chart resource which points to the Helm chart's repository and specifies the chart name and version.
      • If there are custom configuration parameters needed for Label Studio, you can define them in a values object and pass it to the chart.

    Here's what the Pulumi program would look like:

    import * as k8s from "@pulumi/kubernetes"; // Replace these variables with the actual information from the Label Studio Helm chart const chartRepoUrl = "HELM_CHART_REPO_URL"; // The repository URL where the chart is located const chartVersion = "CHART_VERSION"; // The version number of the chart // Custom values for the Helm chart. Replace these with your configurations. const customValues = { // Example value: specify a custom Label Studio configuration parameter service: { type: "ClusterIP", }, }; // Create a Kubernetes provider using the default context from kubeconfig const provider = new k8s.Provider("k8s-provider", { kubeconfig: "~/.kube/config", // Assumes kubeconfig is at the default location }); // Deploy the Label Studio Helm chart const labelStudioChart = new k8s.helm.v3.Chart("label-studio-chart", { chart: "label-studio", version: chartVersion, fetchOpts: { repo: chartRepoUrl, }, values: customValues, }, { provider }); // Export the Chart's public endpoint export const labelStudioEndpoint = labelStudioChart.getResourceProperty("v1/Service", "label-studio", "status"); // Adjust the resource type and names based on actual output

    Replace HELM_CHART_REPO_URL and CHART_VERSION with the actual Helm chart repository URL and chart version for Label Studio. Customize the customValues variable with any configuration options that are specific to your Label Studio deployment needs.

    This Pulumi program will deploy the specified version of Label Studio to your Kubernetes cluster. It exports the endpoint of the Label Studio service, which you can use to access the application once it's running.

    Please make sure to review and adjust the labelStudioChart.getResourceProperty line based on the actual output of the Helm chart. It's important to specify the correct resource type (v1/Service) and names (label-studio) as they appear in your Kubernetes cluster after deployment.

    Once you've created the program, you can deploy it using the Pulumi CLI with the following commands:

    pulumi up # Review and confirm the deployment plan

    After executing pulumi up, Pulumi will show you a preview of the resources that will be created. Confirm the deployment and Pulumi will proceed with deploying Label Studio to your Kubernetes cluster. Once the deployment is successful, you will see the exported labelStudioEndpoint, which you can use to access Label Studio.