Deploy the crane helm chart on AWS EKS
TypeScriptTo deploy the Crane Helm chart on AWS EKS, you'll proceed with the following steps:
-
Set up an EKS cluster: You need to have an Amazon EKS cluster running to deploy your Helm chart to. To create one, you can use Pulumi's
eks.Cluster
resource. This will create an EKS cluster with the default configurations unless modified. -
Install the Helm Chart: Once the cluster is up and running, you will then proceed to install the Helm chart using Pulumi's
kubernetes.helm.v3.Chart
resource. This resource is part of the Pulumi Kubernetes provider and allows you to deploy Helm charts into a Kubernetes cluster.
Below is a detailed Pulumi program written in TypeScript which will set up an EKS cluster and then deploy the Crane Helm chart on it. Make sure you have Pulumi installed, as well as the necessary AWS credentials configured to run this program.
import * as eks from "@pulumi/eks"; import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster with the default configuration. const cluster = new eks.Cluster("myCluster", { desiredCapacity: 2, // You can specify the desired number of worker nodes here. minSize: 1, maxSize: 3, // The following are optional and are shown here for educational purposes. // instanceType: "t2.medium", // Uncomment to specify the instance type for the worker nodes. // version: "1.21", // Uncomment to specify the EKS cluster version. }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // A Kubernetes provider that uses the cluster's kubeconfig to communicate with the cluster. const provider = new k8s.Provider("provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the Crane Helm chart into the EKS cluster. const craneChart = new k8s.helm.v3.Chart("crane", { repo: "crane-chart-repo", // Replace with the actual Helm chart repository name. chart: "crane", // The name of the chart as found in the Helm repository. version: "1.0.0", // Specify the chart version you wish to deploy. // You can also provide custom values to the Helm chart using the values property. // values: { // key: "value", // }, }, { provider }); // Export the Helm chart resources. export const craneResources = craneChart.resources;
Here's what each part of this program does:
- The
eks.Cluster
resource creates an EKS cluster with a specified number of worker nodes. - The
kubeconfig
export provides the kubeconfig needed to interact with the EKS cluster, which you can use with kubectl or other Kubernetes management tools. - The
k8s.Provider
resource sets up the Kubernetes provider to interact with your EKS cluster using the generated kubeconfig. - The
k8s.helm.v3.Chart
resource deploys the Crane Helm chart to your EKS cluster. You must replace"crane-chart-repo"
with the name of the repository where the Crane chart is located. Thechart
andversion
fields are also customizable based on the specific chart version you seek to deploy.
To run this program:
- Create a new Pulumi project and replace the
index.ts
file's contents with the above code. - Run
pulumi up
to initiate the deployment. - Pulumi will print out a summary of the planned changes before they are applied. Review the summary and confirm the changes by typing
yes
.
Remember to replace the Helm chart repository name and any specific configurations that you might need for your deployment, such as instance types or Kubernetes versions.
Finally, the
craneResources
export will provide detailed output of all Kubernetes resources created by the Helm chart, which can be useful for debugging or further automation.-