Deploy the temporal-stack helm chart on Kubernetes
TypeScriptTo deploy the Temporal stack on Kubernetes using Pulumi, we would typically use the
helm.v3.Chart
resource from the Pulumi Kubernetes provider. This resource allows you to deploy Helm charts into a Kubernetes cluster. Helm is a package manager for Kubernetes that packages multiple Kubernetes resources into a single logical deployment unit called a Chart.Deploying a Helm chart typically involves the following steps:
- Ensuring you have a Kubernetes cluster up and running.
- Configuring Pulumi to use the right kubeconfig file that allows authentication to your cluster.
- Writing the Pulumi code to deploy the Helm chart into the Kubernetes cluster.
The
helm.v3.Chart
resource allows you to specify the chart to deploy along with various configurations like values to override the default chart values, the release name, the namespace to deploy into, and other options.Below is the TypeScript program which uses Pulumi to deploy the
temporal-stack
Helm chart to a Kubernetes cluster:import * as kubernetes from "@pulumi/kubernetes"; // Create a resource for the Temporal Helm chart. const temporal = new kubernetes.helm.v3.Chart("temporal-stack", { // Use the name of the chart as found in the Helm repository. chart: "temporal", // Specify the Helm repository URL where the chart is located. // This example assumes that 'temporal' helm chart is present in the stable repository. fetchOpts: { repo: "https://charts.temporal.io", }, // Optionally, specify the namespace to install into. // Create the namespace resource if it doesn't exist, or you can create a separate Pulumi Kubernetes namespace resource and pass the output name here. namespace: "temporal-namespace", // If needed, you can customize the chart values by specifying the 'values' property. values: { // Place your overrides here, for example: // server: { // replicaCount: 2, // }, }, }); // Export any necessary resources. For example, we might want to export the service URL if our chart creates a LoadBalancer service. // You can run `pulumi up` to deploy this chart to your Kubernetes cluster.
In this code:
- We import the
@pulumi/kubernetes
package, which contains helpers for deploying Kubernetes resources using Pulumi. - We then create a new
Chart
resource, providing it with a name (temporal-stack
), and configuring it with the chart details such as the name (temporal
) and the repository (https://charts.temporal.io
). - You can also specify a namespace, and optionally provide configuration overrides through the
values
argument as YAML or a JSON struct. - After deploying the chart with Pulumi (by running
pulumi up
in your CLI), you might want to export resources created by the chart, for example, a LoadBalancer service URL so you can access your Temporal instance from outside the Kubernetes cluster.
Make sure that you have configured your Pulumi Kubernetes provider to interact with your cluster. This is usually done by setting your kubeconfig file which allows Pulumi to authenticate with your Kubernetes cluster.
Keep in mind that this example assumes that the Temporal Helm chart is located in a repository at
https://charts.temporal.io
. If the chart is located in a different repository or a repository that requires authentication, please adjust thefetchOpts
configuration accordingly.Ensure you have Pulumi installed and configured to run this program. If running in an environment where the Kubernetes config is not dynamically discoverable, you might have to pass the kubeconfig explicitly during the creation of the Pulumi Kubernetes provider.