Deploy the nova helm chart on Kubernetes
TypeScriptTo deploy the Nova Helm chart on Kubernetes using Pulumi, you will need to utilize the
Chart
resource from the Pulumi Kubernetes provider. This resource allows you to install a Helm chart into a Kubernetes cluster. The Helm chart could be from any source – a Helm repository or a local directory containing the Helm chart.Below, I am providing you with a Pulumi TypeScript program that demonstrates how to deploy the Nova Helm chart on a Kubernetes cluster. For simplicity, we will install the Nova chart into the default namespace. If you wish to specify a different namespace or add more configuration values, you can simply modify the
values
field or add anamespace
property to theChart
declaration.Here is the step-by-step program:
- Importing Libraries: We start by importing the necessary Pulumi and Kubernetes libraries.
- Helm Chart: We declare a new Helm chart resource using
new kubernetes.helm.v3.Chart
. We specify the name of the chart and optionally the repository if the chart is not in the local filesystem. - Chart Values: We provide any custom values for the Helm chart in the
values
object (if required). - Deployment: The
new kubernetes.helm.v3.Chart
call will ensure that the chart is installed on your cluster. - Exporting Values: After the chart is deployed, you may want to export certain values from the chart, such as service endpoints. In this example, we're not doing so, but you could add
export
statements if needed.
import * as pulumi from "@pulumi/pulumi"; import * as kubernetes from "@pulumi/kubernetes"; // Ensure you have configured the Kubernetes provider. The provider uses the current context from your kubeconfig. const provider = new kubernetes.Provider("k8s"); // Deploy the Nova Helm chart, here we assume it's available in a reachable Helm repository. const novaHelmChart = new kubernetes.helm.v3.Chart("nova-chart", { // Replace with the actual chart name if different. chart: "nova", // You can specify the repository with `repo` property. // For example if your chart is in the Bitnami repo you could add: // repo: "https://charts.bitnami.com/bitnami", // If you have the chart locally, you could use `path` property to specify its directory. // Specify custom values for the chart (if necessary). values: { // Add your custom values here, for example: // service: { // type: "ClusterIP" // } }, }, { provider }); // After deploying, you can export specific values from the chart, such as the service endpoint. // In this case, we're not exporting any values, but you could do something like this: // export const serviceEndpoint = novaHelmChart.getResourceProperty("v1/Service", "nova-service", "status").apply(s => s.loadBalancer.ingress[0].hostname); // To view the endpoint you would run `pulumi stack output serviceEndpoint` after deploying the stack.
In this program, the
provider
represents your configured Kubernetes provider. This should automatically use your current kubeconfig settings to interact with your cluster. Be sure you have the correct context selected if you have multiple clusters configured.Remember, since this program deploys a Helm chart into a Kubernetes cluster, you must ensure that:
- You have
kubectl
installed and configured with access to your Kubernetes cluster. - You have Pulumi CLI installed and logged in.
- Your desired Helm chart is available, and you enter the correct repository URL if it is not stored locally.
- The version of the Pulumi Kubernetes provider supports the Helm and Kubernetes versions you are using.
Remember to review and customize where necessary, such as setting the repository or path to the chart and configuring any required parameters for the Nova chart deployment with the
values
object. After making any necessary customizations and ensuring your environment is correctly set up, you can runpulumi up
to deploy the Helm chart.