Deploy the k8ssandra-common helm chart on AWS EKS
TypeScriptTo deploy the
k8ssandra-common
Helm chart on an AWS EKS cluster using Pulumi, you need to follow these steps:- Create an EKS cluster using Pulumi's EKS package.
- Deploy the
k8ssandra-common
Helm chart to the EKS cluster.
Step 1: Create an EKS Cluster
Firstly, you'll need to set up an Amazon EKS cluster. Here, we'll use Pulumi's EKS package (
eks.Cluster
) because it provides a high-level abstraction that simplifies the creation of an EKS cluster. This package creates and manages the necessary AWS resources like the EKS cluster itself, the worker nodes, and any associated networking resources like VPCs and subnets.Reference to EKS cluster documentation: EKS Cluster
Step 2: Deploy Helm Chart to EKS Cluster
After the EKS cluster is up and running, you'll deploy the
k8ssandra-common
Helm chart using Pulumi's Kubernetes provider, which allows you to deploy Helm charts in a Kubernetes cluster.Reference to Helm Chart documentation: Helm Chart
Below is a Pulumi program written in TypeScript that illustrates both steps:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS Cluster const cluster = new eks.Cluster("myCluster", { desiredCapacity: 2, minSize: 1, maxSize: 3, storageClasses: "gp2" // Other options can be provided based on your requirements. // For full config options, refer to the Pulumi EKS Cluster documentation mentioned above. }); // Export the cluster kubeconfig to access the cluster using kubectl export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy k8ssandra-common Helm chart on EKS Cluster const k8ssandraCommonChart = new k8s.helm.v3.Chart("k8ssandra-common", { chart: "k8ssandra-common", version: "1.0.0", // Replace with the actual chart version you need fetchOpts: { repo: "https://helm.k8ssandra.io/" } }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig }) }); // Export the Chart name of the deployed Helm Chart export const chartName = k8ssandraCommonChart.chartName
This program:
- Imports the necessary Pulumi packages for AWS EKS and Kubernetes (
@pulumi/eks
and@pulumi/kubernetes
). - Creates an EKS cluster with the specified size and storage class. The
desiredCapacity
,minSize
,maxSize
, andstorageClasses
are some of the configuration parameters you can set when creating a cluster. You can customize these as needed. - Exports the
kubeconfig
which is necessary to interact with the Kubernetes cluster usingkubectl
. - Creates a new Helm chart resource representing the
k8ssandra-common
chart from the specified Helm repository. - Uses a Kubernetes provider configured with the
kubeconfig
obtained from the EKS cluster to ensure that the Helm chart is deployed to the right cluster.
To actually deploy this Pulumi program, you would need to:
- Install Pulumi and configure AWS access.
- Create a new Pulumi project and stack.
- Place the above code in an
index.ts
file. - Run
pulumi up
to execute the Pulumi program and deploy the resources.
Remember, the versions and configuration parameters I've used here are illustrative. You should replace them with the actual versions and the configuration that is appropriate for your use case.