Deploy the redisoperator helm chart on AWS EKS
TypeScriptTo deploy the
redisoperator
Helm chart on AWS Elastic Kubernetes Service (EKS), you'll need to create an EKS cluster, get the Helm chart, and deploy it to the cluster. Below is an overview of the steps you'll be taking in the Pulumi TypeScript program:-
Create an EKS Cluster: Using Pulumi's EKS package, we will instantiate a managed Kubernetes cluster. The
eks.Cluster
class will help create and configure an EKS cluster with sensible defaults. -
Deploy Helm Chart to EKS: After the cluster is up and running, we use Pulumi's
kubernetes.helm.v3.Chart
resource to deploy theredisoperator
Helm chart onto the EKS cluster. This resource can install, manage, and uninstall Helm charts in a Kubernetes cluster.
Below is a Pulumi program written in TypeScript that fulfills your goal:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster. const cluster = new eks.Cluster("my-cluster", { // Specify the desired number of cluster nodes. desiredCapacity: 2, minSize: 1, maxSize: 3, // Specify the instance type to use for the cluster nodes. instanceType: "t2.medium", }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses our EKS cluster. const provider = new k8s.Provider("my-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the redisoperator Helm chart to the EKS cluster. const redisOperatorChart = new k8s.helm.v3.Chart("redis-operator", { chart: "redis-operator", version: "X.Y.Z", // Replace X.Y.Z with the latest chart version fetchOpts: { repo: "https://charts.bitnami.com/bitnami", }, }, { provider }); // Export the Redis operator status export const redisOperatorStatus = redisOperatorChart.status;
Here's an explanation of the code:
-
EKS Cluster: The
eks.Cluster
class is creating a Kubernetes cluster in AWS EKS. It takes parameters to configure the number of nodes (desiredCapacity
,minSize
, andmaxSize
), the type of instance (instanceType
), and others. Related documentation for this resource can be found here. -
Kubeconfig: The output
kubeconfig
is the configuration needed to connect to the cluster withkubectl
and other tools. This is exported so that you can easily access your cluster from outside Pulumi. -
Kubernetes Provider: The
k8s.Provider
resource points to our EKS cluster. It uses thekubeconfig
from the EKS cluster which allows Pulumi to deploy Kubernetes resources to that cluster. -
Helm Chart: The
k8s.helm.v3.Chart
class represents a Helm chart. In this case, it is used to deployredis-operator
. You'll need to replaceX.Y.Z
with the version number of the chart you wish to deploy. ThefetchOpts.repo
specifies the Helm repository URL where the chart is located. It's important to change thechart
,version
, andrepo
values based on the actual Helm chart details you want to deploy. The documentation for using Helm charts with Pulumi can be found here. -
Redis Operator Status: Exporting the
redisOperatorChart.status
allows you to retrieve the deployment status of the Redis operator Helm chart. This way you can monitor when the chart has been successfully deployed.
Please replace the placeholders, like the version number, with actual values appropriate for your deployment. Also, set up your AWS credentials and Pulumi configuration before running this program.
-