Deploy the turborepo-remote-cache helm chart on AWS EKS
TypeScriptTo deploy the
turborepo-remote-cache
Helm chart on AWS EKS using Pulumi, we will perform several steps:-
Create an EKS Cluster: We will use the
awsx
package because it provides higher-level abstractions that simplify the creation of an Amazon EKS cluster. -
Deploy the Helm Chart: Once the cluster is set up, we'll use the
kubernetes
package to deploy theturborepo-remote-cache
Helm chart into our EKS cluster.
Here's a detailed step-by-step Pulumi program in TypeScript which will do the following:
- Initialize the EKS cluster using the
awsx
package. - Deploy a Helm chart using the
kubernetes
package.
import * as awsx from "@pulumi/awsx"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS cluster const cluster = new awsx.eks.Cluster("my-cluster", { // Specify the desired settings for the EKS cluster here, such as the instance type for the worker nodes }); // Step 2: Deploy the turborepo-remote-cache Helm chart to the EKS cluster // Note that you need to specify the repository where the Helm chart is located if it's not included in the default Helm repo. const turborepoRemoteCacheChart = new k8s.helm.v3.Chart("turborepo-remote-cache-chart", { chart: "turborepo-remote-cache", // Uncomment and specify the repository if the chart is not in the default Helm repo // repo: "<repository>", namespace: "default", // replace with the namespace where you want to deploy the chart fetchOpts: { repo: "https://turborepo-remote-cache-charts.storage.googleapis.com/", // the Helm chart repository URL }, }, { provider: cluster.provider }); // Export the EKS cluster's kubeconfig and the Helm chart deployment status export const kubeconfig = cluster.kubeconfig; export const chartStatus = turborepoRemoteCacheChart.status;
Explanation:
-
The
awsx.eks.Cluster
resource initializes the EKS cluster. We useawsx
for more straightforward and less verbose code compared to the lower-levelaws
package. More details can be found in the AWSX EKS documentation. -
The
k8s.helm.v3.Chart
resource is responsible for deploying the Helm chart to the Kubernetes cluster. When deploying a Helm chart using Pulumi, we must specify thechart
,namespace
, and, if necessary, therepo
where the Helm chart is located. For charts not located in the default Helm repository, we need to includefetchOpts
with therepo
URL. You will need to replace"https://turborepo-remote-cache-charts.storage.googleapis.com/"
with the actual repository URL where theturborepo-remote-cache
Helm chart is stored. If the chart is in a standard repository already added to Helm, therepo
field can be omitted. More information on the Helm Chart resource is available in the Kubernetes Helm Chart documentation. -
We are exporting
kubeconfig
for you to interact with your Kubernetes cluster using kubectl or other Kubernetes management tools. -
The
chartStatus
is exported to give you information about the deployment status of the Helm chart.
Now, install the required Pulumi packages by running the following commands:
pulumi plugin install resource aws v6.13.3 pulumi plugin install resource awsx 1.0.6 pulumi plugin install resource eks 1.0.3 pulumi plugin install resource kubernetes 4.4.0
And initialize your Pulumi project and stack:
pulumi new typescript --name <your-project-name> pulumi stack init <your-stack-name>
After initializing the project and stack, you could place the Pulumi TypeScript code above in your
index.ts
file. Then, runpulumi up
to execute the script, which will create your AWS EKS cluster and deploy theturborepo-remote-cache
Helm chart onto it.-