Deploy the wavefront-hpa-adapter helm chart on Rancher
TypeScriptDeploying Helm charts with Pulumi involves a few steps, and the specific case of deploying to a Rancher-managed Kubernetes cluster requires some prerequisites.
Before proceeding, ensure that you have:
- Rancher Cluster: A working Rancher Kubernetes cluster where you can deploy applications. You should have the kubeconfig file for this cluster.
- Pulumi: Installation of Pulumi CLI on your system and setup done for the desired cloud provider.
- Helm: The Helm CLI installed on your system.
- Rancher2 Pulumi Provider: The Pulumi provider for interfacing with Rancher2's API (which you'd need to install and setup beforehand).
- Access and credentials: Necessary permissions and credentials setup to deploy resources on the Rancher cluster.
In this guide, we will be creating a Pulumi program in TypeScript which deploys the
wavefront-hpa-adapter
Helm chart to a Rancher-managed Kubernetes cluster. We will use the Rancher2 provider for Pulumi to manage resources within Rancher.Here is a step-by-step TypeScript program that accomplishes the deployment:
import * as pulumi from '@pulumi/pulumi'; import * as k8s from '@pulumi/kubernetes'; import * as rancher2 from '@pulumi/rancher2'; // Step 1: Load the kubeconfig from Rancher. In a real scenario, you'd probably fetch this from Pulumi's config. const kubeconfig = pulumi.output('<your-rancher-cluster-kubeconfig>'); // Step 2: Create a Pulumi Kubernetes provider using the Rancher kubeconfig. const k8sProvider = new k8s.Provider('rancher-k8s', { kubeconfig }); // Step 3: Deploy the wavefront-hpa-adapter Helm chart. const wavefrontHpaAdapterChart = new k8s.helm.v3.Chart('wavefront-hpa-adapter', { // To specify the chart version you can add version keyword in the ChartOpts chart: 'wavefront-hpa-adapter', version: '<chart-version>', // specify the chart version here namespace: 'kube-system', // assumes the Helm chart installs into 'kube-system' namespace // Values for the Helm chart can be provided here. For instance: values: { // ... provide the necessary values here }, }, { provider: k8sProvider }); // Export resources such as the Chart name export const chartName = wavefrontHpaAdapterChart.metadata.apply(meta => meta.name);
Replace
<your-rancher-cluster-kubeconfig>
and<chart-version>
with your specific Rancher kubeconfig content and the exact version of thewavefront-hpa-adapter
chart you want to deploy. In a typical real-world scenario, you would likely need to provide additional configuration via thevalues
object to customize the deployment ofwavefront-hpa-adapter
for your needs.It's important to make sure that the
values
object specifies the correct Helm values. You can get these details from the chart's official documentation or the output of runninghelm show values <chart-name>
in your CLI.Once you have set up the Pulumi program, with the
pulumi up
command you can deploy thewavefront-hpa-adapter
to your Rancher Kubernetes cluster. Thepulumi up
invocation will show you a preview of the actions Pulumi plans to take. Confirm the actions to proceed with the actual deployment.The
export
statement at the end of the Pulumi program allows you to retrieve the name of the deployed chart after the deployment is completed, which can be useful for querying the deployed resources or for setting up dependencies in more complex Pulumi programs.Please note that the actual content of the
kubeconfig
and thevalues
you provide are sensitive and should be managed securely according to best practices. In most scenarios, these should not be hard-coded, but could be managed via Pulumi's configuration system or another secrets management approach.