Deploy the canary-checker helm chart on AWS EKS
TypeScriptDeploying a Helm chart to an Amazon EKS cluster involves several steps with Pulumi:
-
Provisioning an EKS Cluster: We'll create an EKS cluster using the
eks.Cluster
resource. This automatically sets up the necessary infrastructure such as worker nodes and networking. -
Helm Chart Deployment: We'll use the
kubernetes.helm.sh/v3.Chart
resource to deploy the canary-checker Helm chart to the EKS cluster we provisioned.
Let's walk through the code to achieve that:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS cluster. const cluster = new eks.Cluster("my-cluster", { instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 2, storageClasses: "gp2", deployDashboard: false, }); // Step 2: Deploy the canary-checker Helm chart into the cluster. const helmChart = new k8s.helm.v3.Chart("canary-checker", { chart: "canary-checker", version: "0.1.0", // specify the version of the chart fetchOpts: { repo: "https://charts.flanksource.com", // This needs to be the repository URL hosting the canary-checker chart }, }, { provider: cluster.provider }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig;
Detailed Explanation
-
We initialize a new EKS cluster with
eks.Cluster
passing in a few configurations such as instance type (t2.medium
is chosen here for demonstration purposes, but should be updated based on your requirements) and desired capacity which will control the scaling of the worker nodes. -
storageClasses
is set to"gp2"
, which is the general-purpose SSD volume type for Amazon EBS. -
We set
deployDashboard
tofalse
since it is not necessary for this deployment. -
Once the EKS cluster resource is declared, we use
k8s.helm.v3.Chart
to deploy the canary-checker Helm chart. We specify the chart name, version, and repository URL in thefetchOpts
. -
A kubeconfig is exported which can be used to interact with the EKS cluster via
kubectl
or other Kubernetes tools. -
The
{ provider: cluster.provider }
ensures that the helm chart is installed into the EKS cluster that we created. It fetches the proper Kubernetes provider instance that is internally connected with the provisioned EKS cluster.
Remember to replace
"https://charts.flanksource.com"
with the actual repository that hosts your desiredcanary-checker
if it's different.With this Pulumi program, you can deploy the
canary-checker
Helm chart to your EKS cluster. You will need to execute this code using Pulumi CLI commandspulumi up
to create and deploy these resources. After running the command, Pulumi will print thekubeconfig
output, which can be used to interact with your EKS cluster.Make sure to have AWS CLI configured with the correct credentials and Pulumi CLI installed on your machine. If you don't have a specific version of the canary-checker Helm chart, you may omit the
version: "0.1.0"
line, and Pulumi will use the latest available version.-