Deploy the digdag helm chart on Kubernetes
TypeScriptIn order to deploy a Helm chart on Kubernetes using Pulumi, you'll leverage the Pulumi Kubernetes provider. Specifically, you'll use the Chart resource from the Helm API extension which is dedicated to managing Helm charts in a Kubernetes cluster.
Here's a step-by-step process of how to create a Pulumi program in TypeScript that deploys the "digdag" Helm chart on a Kubernetes cluster:
-
Set up a New Pulumi Project: You start by creating a new Pulumi project specific to your cloud setup. This assumes you have Pulumi CLI installed and your Kubernetes cluster configured in your cloud environment.
-
Install the Required Pulumi Packages: Ensure you have installed the
@pulumi/kubernetes
package which is needed to interact with Kubernetes resources, including deploying Helm charts. -
Authoring the Pulumi Program: In the Pulumi program, you'll instantiate the
Chart
resource from the Kubernetes package that represents the Helm chart you want to deploy. -
Deploying the Chart: Once the program is ready, you'll use the
pulumi up
command to run the deployment which will send the desired state of theChart
object you've described to your Kubernetes cluster and create those resources accordingly.
Below is the TypeScript Pulumi code that accomplishes the deployment of the "digdag" Helm chart to your Kubernetes cluster.
import * as kubernetes from "@pulumi/kubernetes"; // Create an instance of the Kubernetes Chart class to deploy the digdag Helm chart. const digdagChart = new kubernetes.helm.v3.Chart("digdag", { chart: "digdag", // You'll need to specify the repository where the digdag chart is located if it's not in the default helm repo. // For example, if it's in a Helm repository that you have added with `helm repo add` and named it `my-repo`, replace `repo: 'http://charts.example.com'` with `repo: 'my-repo'`. // repo: "http://charts.example.com", // Uncomment this line when the chart is in a custom repository. // Specify the version of the chart to be deployed, replace 'x.x.x' with the version number you want to use. // version: "x.x.x", // Uncomment this line to specify a version. // You can specify a values.yaml or pass the equivalent values inline here if necessary, for custom configuration. // values: { /* ... */ }, // Uncomment this line to specify chart values. namespace: "default", // Replace with the namespace you want to deploy into, if not 'default'. }); // Export any of the chart values that are needed. export const digdagChartName = digdagChart.metadata.name; // This is a simple program that assumes the Helm chart "digdag" exists in the accessible Helm repository. // If you need to pass additional configurations to your digdag deployment, use the 'values' property of the ChartArgs interface. // You can refer to https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs regarding how to export and interact with the Chart resource's outputs. // To run this Pulumi program: // 1. Ensure you have Pulumi CLI installed and configured with your Kubernetes context. // 2. Run `pulumi new typescript` to create a new Pulumi project and replace the code in `index.ts` with the above. // 3. Install the necessary dependencies by running `npm install @pulumi/kubernetes`. // 4. Run `pulumi up` to execute the deployment.
This program will deploy the "digdag" Helm chart in the default namespace of your Kubernetes cluster. You need to replace the placeholder values like the chart's repository and version if the chart is not in the stable Helm repo or if you want to specify a certain version of the chart. Additionally, you can customize the
values
field to provide a custom configuration for your Digdag instance.Keep in mind that, for Pulumi to manage the resources properly, it requires access to your Kubernetes cluster's configuration context so that it can authenticate and make changes.
Please also update the
namespace
property if you would like to deploy the chart to a namespace other than the default one.To run this program:
- Save the above TypeScript code to an
index.ts
file in the root of your Pulumi project. - Run
npm install
to fetch the necessary dependencies, mainly@pulumi/kubernetes
. - Execute
pulumi up
to preview and deploy the changes to your Kubernetes cluster using Pulumi.
For more details about the
Chart
class and other configurations you can pass, visit theChart
resource documentation.-