Deploy the rke2-multus helm chart on AWS EKS
TypeScriptTo deploy the
rke2-multus
Helm chart on AWS EKS using Pulumi, you first need to create an EKS cluster and then deploy the Helm chart to it. We'll use the@pulumi/eks
and@pulumi/kubernetes
packages to achieve this. The@pulumi/eks
is a high-level Pulumi component that simplifies the creation of EKS clusters, and@pulumi/kubernetes
allows us to work with Kubernetes resources.Below is a Pulumi program in TypeScript that will:
- Create an EKS cluster.
- Create a Kubernetes provider that targets the EKS cluster.
- Deploy the
rke2-multus
Helm chart using the created provider.
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create an EKS cluster with default settings. const cluster = new eks.Cluster("my-eks-cluster", {}); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses our EKS cluster's kubeconfig. const provider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the `rke2-multus` Helm chart to the EKS cluster using the Kubernetes provider. const rke2MultusChart = new k8s.helm.v3.Chart("rke2-multus", { chart: "rke2-multus", fetchOpts: { repo: "https://helm-repo-url.com", // Replace with the Helm repo URL where `rke2-multus` is hosted } }, { provider }); // Export the Helm chart resources. export const helmChartResources = rke2MultusChart.resources;
Explanation:
-
The
eks.Cluster
resource creates a new EKS cluster. The name "my-eks-cluster" is what the cluster will be called in AWS. By not specifying any additional options, this resource will create the cluster with the default settings, including the default instance types and the default number of nodes. (EKS Cluster Resource Docs). -
We then export the
kubeconfig
which is the configuration needed to connect to the cluster withkubectl
and other Kubernetes tools. Thiskubeconfig
will be automatically generated by Pulumi. -
We create a new
k8s.Provider
, which is how Pulumi communicates with a Kubernetes cluster. By passing the generatedkubeconfig
to this provider, we tell Pulumi that it should manage Kubernetes resources in the EKS cluster we just created. -
The
k8s.helm.v3.Chart
resource is where we specify the deployment of therke2-multus
Helm chart. We specify the name of the chart and the repository where it's located with therepo
field infetchOpts
. You need to replacehttps://helm-repo-url.com
with the actual URL where therke2-multus
chart is stored. This chart will be deployed into the EKS cluster using thek8s.Provider
we defined earlier.
To use this code, you will need to have Pulumi and AWS CLI set up and configured. Save this code in a file named
index.ts
, and then you can deploy it by runningpulumi up
in the same directory as your code. This will start the Pulumi deployment process.Please note that you need to replace
https://helm-repo-url.com
with the actual Helm repository URL where therke2-multus
chart is stored. If there are any additional configuration parameters you want to set for the Helm chart, you can do so by adding avalues
property within thek8s.helm.v3.Chart
resource.