Deploy the tekton-operator helm chart on Kubernetes
TypeScriptDeploying a Helm chart on Kubernetes can be accomplished using Pulumi's
kubernetes
package, which allows you to manage Kubernetes resources directly in Pulumi code.In this example, you'll be using the
kubernetes.helm.v3.Chart
resource from the Pulumi Kubernetes provider. This resource is a high-level abstraction that deploys a Helm chart either from a repository or from a local path.The
Chart
resource requires you to specify the chart name and the repository URL where the chart can be found. In the case of the Tekton Operator, the chart is available in the official Tekton Helm chart repository.Here's what you need to do:
- Install the Pulumi CLI and set up your Kubernetes cluster.
- Create a new Pulumi project or use an existing one.
- Use the code provided below to deploy the Tekton Operator Helm chart.
Let's take a look at a Pulumi TypeScript program that accomplishes this:
import * as k8s from "@pulumi/kubernetes"; const tektonOperatorChart = new k8s.helm.v3.Chart("tekton-operator", { chart: "tekton-operator", version: "0.6.0", // specify the desired chart version fetchOpts: { repo: "https://tekton.dev/charts", // Tekton Helm chart repository }, }); export const chartName = tektonOperatorChart.chart;
Here’s a detailed breakdown of the code:
-
First, you import the
@pulumi/kubernetes
package which contains the necessary components to interact with Kubernetes. -
Next, you create an instance of the
Chart
resource, namedtekton-operator
. This resource will represent the Tekton Operator Helm chart in your Pulumi application. -
The
chart
property is set to"tekton-operator"
, which is the name of the Helm chart you want to deploy. -
The
version
property allows you to pin the chart to a specific version. This is optional, but it's a good practice to ensure consistent deployments. -
The
fetchOpts.repo
property specifies the URL of the Helm repository containing the Tekton Operator chart.
After you've written this code in your Pulumi project, you can deploy it with the following commands:
pulumi up
This will start the deployment process, and you'll be prompted to confirm the deployment after reviewing the changes.
Once you confirm, Pulumi will deploy the Tekton Operator Helm chart to your Kubernetes cluster. You can check the status of the deployment with kubectl or by checking the Pulumi console. The
export
statement at the end of the program allows you to output the chart name after deployment, which can be useful for reference purposes.Remember, you'll need to have your Kubernetes cluster's configuration set up for Pulumi and have the correct context selected for your Kubernetes cluster in your kubeconfig file, as Pulumi will use this to connect to and manage your Kubernetes resources.