Deploy the github-prometheus-exporter helm chart on AWS EKS
TypeScriptTo deploy the
github-prometheus-exporter
Helm chart on AWS EKS using Pulumi, we'll go through a multi-step process:- Provision an Amazon EKS cluster using
aws.eks.Cluster
. - Create an instance of
kubernetes.helm.v3.Chart
to deploy thegithub-prometheus-exporter
Helm chart to the EKS cluster.
Before proceeding, ensure you have Pulumi and AWS CLI installed and configured on your machine. Additionally, you should be logged into the AWS CLI with the necessary permissions to create EKS clusters and deploy Helm charts.
Here's a Pulumi TypeScript program that accomplishes these tasks:
import * as aws from "@pulumi/aws"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster with the default configuration. const cluster = new eks.Cluster("my-cluster", { minSize: 2, // Minimum number of worker nodes maxSize: 4, // Maximum number of worker nodes desiredCapacity: 3, // Desired number of worker nodes at cluster creation }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Deploy the github-prometheus-exporter Helm chart to the cluster. const githubPrometheusExporter = new k8s.helm.v3.Chart("github-prometheus-exporter", { chart: "prometheus-exporter", fetchOpts:{ repo: "https://prometheus-community.github.io/helm-charts", }, // Set the values for the Helm chart as needed. values: { // Values related to github-prometheus-exporter }, }, { provider: cluster.provider }); // Export the Helm chart deployment status export const helmDeploymentStatus = githubPrometheusExporter.status;
Explanation:
- We import required modules from Pulumi's AWS, EKS, and Kubernetes libraries.
- We instantiate an EKS cluster with a minimum of two nodes, a maximum of four, and with three nodes desired initially.
- We export the
kubeconfig
which can be used to interact with the cluster viakubectl
. - We then declare a Helm chart resource to deploy the
github-prometheus-exporter
Helm chart using theprometheus-community
Helm repository. - You can modify the
values
to configure your Helm chart accordingly. This typically includes settings specific to the chart, such as the service account to use, resource limits, or the specific app configurations. - We export the Helm chart deployment status, which might include details indicating the success or failure of the chart installation.
Run this Pulumi program to provision the resources. Upon completion, you will get the
kubeconfig
and the status of the Helm chart deployment outputted as stack exports. Usekubectl
with the exportedkubeconfig
to manage your Kubernetes resources.For more details on AWS EKS with Pulumi, you can refer to the AWS EKS Cluster documentation, and for Helm charts in Kubernetes with Pulumi, you can see the Helm v3 Chart documentation.
- Provision an Amazon EKS cluster using