Deploy the prometheus-freebox-exporter helm chart on Kubernetes
TypeScriptDeploying a Helm chart to a Kubernetes cluster using Pulumi is straightforward. In this case, we want to deploy the
prometheus-freebox-exporter
Helm chart. To deploy a Helm chart, we'll use theChart
resource from the Pulumi Kubernetes provider.Here's how you would accomplish that in TypeScript using Pulumi:
-
Setup Your Project: First, you would need a Pulumi project. If you haven't done so, you would use
pulumi new
to create a new project in the language of your choice (TypeScript, in this case). -
Install the Pulumi Kubernetes Package: You'll need to have the Pulumi Kubernetes SDK installed in your project. This is done using
npm
oryarn
for TypeScript projects. Runnpm install @pulumi/kubernetes
oryarn add @pulumi/kubernetes
in your project directory. -
Write Your Pulumi Code: Below is a Pulumi program in TypeScript that deploys the
prometheus-freebox-exporter
Helm chart to a Kubernetes cluster.
import * as k8s from "@pulumi/kubernetes"; // Specify the namespace where the Helm chart should be deployed. const namespace = "default"; // Deploy the 'prometheus-freebox-exporter' Helm chart. const prometheusFreeboxExporter = new k8s.helm.v3.Chart("prometheus-freebox-exporter", { // Replace 'REPO_NAME' with the actual Helm repository name, // and 'REPO_URL' with the repository URL where the chart is hosted. repo: "REPO_NAME", chart: "prometheus-freebox-exporter", version: "CHART_VERSION", // Specify the chart version you wish to deploy namespace: namespace, // If there are any custom values you wish to override in the chart, // specify them here, otherwise this field can be omitted or left empty. values: { // Example of custom values. Replace with actual values of the chart. // service: { // type: "LoadBalancer", // }, }, }, { provider: /* specify your k8s provider if necessary */ }); export const chartName = prometheusFreeboxExporter.metadata.name;
- Run Your Pulumi Program: Use
pulumi up
to preview and deploy your changes. Pulumi will show you a preview and, upon confirmation, perform the deployment.
Important Notes
namespace
: Make sure to deploy the Helm chart in the correct Kubernetes namespace. In the example, we're using thedefault
namespace. Change this to the namespace you want the chart to be deployed in.repo
: You will need to replaceREPO_NAME
with the name of the Helm repository where theprometheus-freebox-exporter
chart is located.chart
: The name of the chart to deploy, which in this case isprometheus-freebox-exporter
.version
: ReplaceCHART_VERSION
with the specific version of theprometheus-freebox-exporter
chart you want to install.values
: This is a JavaScript object that should mirror the structure of thevalues.yaml
in the Helm chart itself. If the chart requires certain values to be set or you want to customize the deployment, you set them here.provider
: If you're working with a Kubernetes provider (like EKS, AKS, GKE, etc.), make sure to set the provider info accordingly. Otherwise, Pulumi will use the default provider configured in your kubeconfig.
After you run
pulumi up
, Pulumi will perform the deployment, and you will see the resources being created in your terminal. Once the deployment is successful, you can check the Kubernetes resources created by the Helm chart usingkubectl
or Pulumi's output exports.-