1. Answers
  2. Deploy GitLab Agent Helm Chart on Rancher

How do I deploy the GitLab Agent Helm chart on Rancher?

This guide demonstrates how to deploy the GitLab Agent Helm chart on a Rancher-managed Kubernetes cluster using Pulumi. The GitLab Agent provides a way to connect your Kubernetes cluster to GitLab, enabling GitOps workflows and other integrations.

Steps:

  1. Setup Pulumi Project: Initialize a new Pulumi project.
  2. Configure Kubernetes Provider: Ensure the Kubernetes provider is configured to communicate with your Rancher-managed cluster.
  3. Deploy Helm Chart: Use the Pulumi Kubernetes provider to deploy the GitLab Agent Helm chart.

Below is the complete Pulumi program in TypeScript to accomplish this:

import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";

// Create a new Kubernetes provider instance
const k8sProvider = new k8s.Provider("k8sProvider", {
    kubeconfig: process.env.KUBECONFIG, // Ensure KUBECONFIG environment variable is set
});

// Define values for the GitLab Agent Helm chart
const gitlabAgentValues = {
    gitlabUrl: "https://gitlab.example.com",
    token: "your-gitlab-agent-token",
};

// Deploy the GitLab Agent Helm chart
const gitlabAgent = new k8s.helm.v3.Chart("gitlab-agent", {
    chart: "gitlab-agent",
    version: "1.0.0", // Specify the desired version
    fetchOpts: {
        repo: "https://charts.gitlab.io",
    },
    values: gitlabAgentValues,
}, { provider: k8sProvider });

// Export the Helm release name
export const gitlabAgentReleaseName = gitlabAgent.getResource("v1/Service", "gitlab-agent").metadata.name;

Key Points:

  • Pulumi Project Initialization: Ensure you have a Pulumi project set up and configured.
  • Kubernetes Provider Configuration: The k8s.Provider uses the KUBECONFIG environment variable to connect to your Rancher-managed Kubernetes cluster.
  • Helm Chart Deployment: The k8s.helm.v3.Chart resource is used to deploy the GitLab Agent Helm chart, specifying the chart version and repository.

Summary:

This guide provided a Pulumi program to deploy the GitLab Agent Helm chart on a Rancher-managed Kubernetes cluster. The program configures the Kubernetes provider, defines the Helm chart values, and deploys the chart using the Pulumi Kubernetes provider.

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up