Deploy the fastly-exporter helm chart on AWS EKS
TypeScriptDeploying the
fastly-exporter
Helm chart on AWS Elastic Kubernetes Service (EKS) involves several steps using Pulumi:-
Firstly, you will need an EKS cluster to deploy your applications. We'll use Pulumi's
eks.Cluster
resource to provision a new EKS cluster. -
Once the EKS cluster is set up, you will need to configure Pulumi to use the Kubernetes provider that targets our EKS cluster.
-
Finally, you can deploy the
fastly-exporter
Helm chart into your EKS cluster. We'll use thekubernetes.helm.v3.Chart
resource for deploying the chart from Helm's repository.
Below is a detailed TypeScript program that accomplishes these steps:
import * as eks from "@pulumi/eks"; import * as pulumi from "@pulumi/pulumi"; import * as kubernetes from "@pulumi/kubernetes"; // Step 1: Initialize an EKS cluster. const cluster = new eks.Cluster("my-cluster", { // Specify the number of cluster nodes desiredCapacity: 2, minSize: 1, maxSize: 2, // Specify the instance size instanceType: "t2.medium", // Choose the version of Kubernetes version: "1.21" }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Configure the Kubernetes provider to use the kubeconfig from the created EKS cluster. const provider = new kubernetes.Provider("provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify) }); // Step 3: Deploy the fastly-exporter Helm chart. const fastlyExporterChart = new kubernetes.helm.v3.Chart("fastly-exporter", { repo: "my-repo", // please replace with actual Helm repo containing "fastly-exporter" chart: "fastly-exporter", version: "1.2.0", // update to the version you need namespace: "monitoring" // specify the namespace where you want to deploy }, { provider }); // Export the status of the deployed Helm chart. export const helmChartStatus = fastlyExporterChart.status;
Explanation
-
eks.Cluster: This resource is used to provision a new managed Kubernetes cluster on AWS EKS. You configure the cluster by specifying the number of nodes, instance types, and Kubernetes version.
-
kubernetes.Provider: This is a Pulumi resource representing a Kubernetes provider that is configured to point to the EKS cluster we've created. This allows us to deploy Kubernetes resources to our EKS cluster.
-
kubernetes.helm.v3.Chart: This resource is responsible for deploying a Helm chart into a Kubernetes cluster. We specify which repository and chart to use, the version we want to deploy, and the namespace it should be deployed in.
What will happen when you run this program?
- Pulumi will provision an EKS cluster using AWS as the cloud provider.
- It will then configure Pulumi to use the Kubernetes provider to interact with the newly created EKS cluster.
- Lastly, Pulumi will deploy the
fastly-exporter
Helm chart into themonitoring
namespace of your EKS cluster using the Helm chart resource.
Next Steps
To get started with this Pulumi program:
- Make sure you have Pulumi CLI installed and AWS CLI configured with the appropriate credentials.
- Create a new directory, navigate to it, and run
pulumi new typescript
to start a new Pulumi project. - Replace the contents of
index.ts
with the program above. - Run
pulumi up
to preview and deploy the resources.
Remember, you may need to replace the
repo
in thefastly-exporter
chart with the actual repository where the chart is hosted.Once the deployment is successful, you can check the status of the deployed Helm chart using the exported
helmChartStatus
.-