Deploy the rollout-restart helm chart on AWS EKS
TypeScriptTo deploy the
rollout-restart
Helm chart on AWS EKS using Pulumi, you will follow these steps:-
Set up an EKS Cluster: You'll need an Amazon EKS cluster as the environment where your Helm chart will be deployed.
-
Define a Kubernetes Provider: This provider is necessary for Pulumi to interact with your EKS cluster.
-
Deploy the Helm Chart: Using Pulumi's
helm.v3.Chart
resource, you'll provide the necessary configuration to deploy therollout-restart
chart.
Below is a TypeScript program that accomplishes these steps:
import * as eks from "@pulumi/eks"; import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster with the default configurations const cluster = new eks.Cluster("my-cluster", {}); // Export the cluster's kubeconfig to connect to it export const kubeconfig = cluster.kubeconfig; // Define a Kubernetes provider that uses the cluster kubeconfig const provider = new k8s.Provider("my-provider", { kubeconfig: cluster.kubeconfig, }); // Deploy the 'rollout-restart' Helm chart const chart = new k8s.helm.v3.Chart("rollout-restart-chart", { chart: "rollout-restart", // You would replace "helm-repo-name" with the name of the repository that hosts the chart. // If the chart is in a public repository, you may omit the 'repo' option. repo: "helm-repo-name", // Replace 'my-namespace' with the Kubernetes namespace you want the chart to be deployed into. namespace: "my-namespace", values: { // Specify the values for the Helm chart here; these will be specific to the rollout-restart chart }, }, { provider }); // Export the status of the rollout export const rolloutStatus = pulumi.output(chart).apply(c => c.status);
Explanation
-
EKS Cluster: The
eks.Cluster
is a high-level component that encapsulates the detailed configuration and creation of an Amazon EKS cluster. It defaults to creating a new VPC with subnets in different availability zones to ensure high availability. -
Kubeconfig Export: The kubeconfig is needed to interact with your cluster. It's exported here so you can use
kubectl
or other Kubernetes tooling outside of Pulumi. -
Kubernetes Provider: You define a Pulumi Kubernetes provider to connect to your EKS cluster. It's like configuring
kubectl
to talk to your cluster; the provider uses the kubeconfig from your newly created EKS cluster to manage Kubernetes resources. -
Helm Chart: The
k8s.helm.v3.Chart
resource represents a Helm chart deployment. It lets you specify the chart name, the repository where it is located, and values that customize the deployment, such as image versions, service type, and resource requests or limits.
Remember to replace
"helm-repo-name"
with the actual repository name where your desired Helm chart is located and ensure that"my-namespace"
is the namespace you want to deploy your chart in. Thevalues
object within the chart definition should include configuration specific to therollout-restart
chart, which you need to get from the chart's documentation or values file.For more details on the
eks.Cluster
andhelm.v3.Chart
resources, you can visit the following links:To run this program, you will need to have Pulumi and the AWS CLI installed and configured with the appropriate AWS credentials. After writing this code to a file (e.g.,
index.ts
), you can deploy it by runningpulumi up
in the same directory.-