2023-05-15 15:25:28 -07:00

4.0 KiB

title_tag, title, layout, meta_desc, meta_image, card_desc, template, cloud
title_tag title layout meta_desc meta_image card_desc template cloud
Deploy a Helm Chart to Kubernetes Cluster Helm Chart on Kubernetes template Easily deploy a Helm chart to an existing Kubernetes cluster with Pulumi and Helm using this template. meta.png Deploy a web application to a Kubernetes cluster with Pulumi and Helm.
prefix dirname languages
helm-kubernetes my-k8s-app
typescript
python
go
csharp
yaml
name slug
Helm Chart helm-chart

The Helm Chart template creates an infrastructure as code project in your favorite language that deploys a Helm chart to an existing cluster using Pulumi. It uses Pulumi's Native Kubernetes Provider to create a new namespace in an existing Kubernetes cluster and a new Helm chart that deploys an application (in this case, the Nginx ingress controller). The template generates a complete infrastructure as code program, including sample application code, to give you a working project out of the box that you can customize easily and extend to suit your needs.

An architecture diagram of the Pulumi Helm Chart template

Using this template

To use this template to deploy a Helm chart to a Kubernetes cluster, make sure you've already provisioned a Kubernetes cluster, installed Pulumi and kubectl, and configured your kubeconfig file. Then create a new project using the template in your language of choice:

{{< templates/pulumi-new >}}

Follow the prompts to complete the new-project wizard. When it's done, you'll have a complete Pulumi project that's ready to deploy and configured with the most common settings. Feel free to inspect the code in {{< langfile >}} for a closer look.

Deploying the project

The template requires no additional configuration. By default, it will install an Nginx ingress controller with Helm. Once the new project is created, you can deploy it immediately with pulumi up:

$ pulumi up

When the deployment completes, Pulumi exports the following stack output values:

name
The name of your new Helm chart deployment.

Output values like these are useful in many ways, most commonly as inputs for other stacks or related cloud resources.

Customizing the project

Projects created with the Helm Chart template expose the following configuration settings:

k8sNamespace
The name of the namespace to be created in your existing cluster. Defaults to nginx-ingress.

All of these settings are optional and may be adjusted either by editing the stack configuration file directly (by default, Pulumi.dev.yaml) or by changing their values with pulumi config set as shown below.

$ pulumi config set someProp ../some/value
$ pulumi up

You can customize the Helm chart by passing values to it in your Pulumi code. An example of passing a few values to the Helm chart is already included in the template for easy reference.

Tidying up

You can cleanly destroy the stack and all of its infrastructure with pulumi destroy:

$ pulumi destroy

Learn more

Congratulations! You're now well on your way to managing a production-grade Kubernetes application with Pulumi --- and there's lots more you can do from here: