Deploy the Data on Kuberenetes K8ssandra Chart helm chart on AWS EKS
TypeScriptTo deploy a Helm chart on an AWS EKS cluster using Pulumi, you need to do the following:
- Set up an EKS cluster using Pulumi.
- Deploy the Helm chart onto the Kubernetes cluster.
Here's a detailed walkthrough with a Pulumi program written in TypeScript:
Creating the EKS Cluster
First, you need to create an EKS cluster. You can use the
eks.Cluster
class from the@pulumi/eks
package, which is a high-level component that simplifies the creation of an EKS cluster.Deploying the Helm Chart
Once you have the EKS cluster running, you can then deploy the K8ssandra Helm chart using the
Chart
resource from the@pulumi/kubernetes
package. This resource allows you to deploy Helm charts in a Kubernetes cluster.The
Chart
resource will handle fetching the chart from the specified repository and deploying it with the provided configuration values.Here's a complete Pulumi TypeScript program that creates an EKS cluster and deploys the K8ssandra Helm chart onto it:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Create an EKS cluster. const cluster = new eks.Cluster("k8ssandra_cluster", { desiredCapacity: 2, minSize: 1, maxSize: 2, storageClasses: "gp2", // specify the storage class deployDashboard: false, // Kubernetes dashboard is optional }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Deploy the K8ssandra Helm chart to the EKS cluster. const k8ssandraChart = new k8s.helm.v3.Chart("k8ssandra", { chart: "k8ssandra", version: "1.0.0", // Specify the chart version you wish to deploy namespace: "default", // Target namespace fetchOpts: { repo: "https://helm.k8ssandra.io/", // Helm chart repository }, }, { provider: cluster.provider }); // Export the Helm chart resources. export const k8ssandraResources = k8ssandraChart.resources;
Explanation
- We create an EKS cluster with the name
k8ssandra_cluster
by instantiatingeks.Cluster
. - We pass in the desired, minimum, and maximum number of instances, along with other options like the storage class and whether to deploy the Kubernetes dashboard.
- We then export the
kubeconfig
which will let us interact with our cluster usingkubectl
or any Kubernetes client. - Next, we create a Helm chart deployment using
new k8s.helm.v3.Chart
. We specify the K8ssandra chart with its name and version, the namespace to deploy into, and the repository where the Helm chart is located. - We use the
cluster.provider
to ensure that the chart is deployed on the previously created EKS cluster. - After the deployment, we export the resources for easy reference.
Usage
To use this program, save it to a file (for example:
eksK8ssandra.ts
) and run it with Pulumi from the terminal:pulumi up
Before running the command, ensure you have Pulumi installed and configured with the appropriate AWS credentials.
After the deployment is complete, you can manage the K8ssandra installation just like any other Kubernetes resources using
kubectl
or Pulumi.