Deploy the prometheus-process-exporter helm chart on AWS EKS
TypeScriptTo deploy the prometheus-process-exporter Helm chart on AWS EKS using Pulumi, you must complete several steps. First, you will need to create an Amazon EKS cluster, which is a managed Kubernetes service. With Pulumi's
aws
andeks
library, creating an EKS cluster is a straightforward process. Then, you will deploy the prometheus-process-exporter Helm chart to the EKS cluster using the Pulumi Kubernetes (kubernetes
) library.Here's a step-by-step guide to accomplish this task:
- Create an EKS cluster: Utilize Pulumi's
eks.Cluster
class to provision an EKS cluster. - Deploy the Helm chart: Once the cluster is running, you can deploy the
prometheus-process-exporter
Helm chart using thekubernetes.helm.v3.Chart
class from Pulumi's Kubernetes package.
Below is a complete program in TypeScript that creates the EKS cluster and deploys the
prometheus-process-exporter
chart onto it. Remember that you will need to have Pulumi CLI installed and configured with your AWS credentials to run this code successfully.import * as pulumi from '@pulumi/pulumi'; import * as aws from '@pulumi/aws'; import * as eks from '@pulumi/eks'; import * as k8s from '@pulumi/kubernetes'; // Create an EKS cluster. const cluster = new eks.Cluster('my-cluster', { instanceType: 't2.medium', desiredCapacity: 2, minSize: 1, maxSize: 3, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses our EKS cluster's kubeconfig. const provider = new k8s.Provider('provider', { kubeconfig: cluster.kubeconfig, }); // Deploy prometheus-process-exporter helm chart to the created EKS cluster. const prometheusProcessExporterChart = new k8s.helm.v3.Chart('prometheus-process-exporter', { repo: 'prometheus-community', // Specify the Helm chart repository. chart: 'prometheus-process-exporter', version: '0.3.1', // Specify the version of the chart. // You can specify the values based on the chart's requirements. // Here we demonstrate a minimal custom values configuration. values: { namespace: 'monitoring', // ... you can include other values necessary for your deployment }, }, { provider }); // Export the Helm chart name and namespace where deployed. export const chart = prometheusProcessExporterChart.name; export const chartNamespace = prometheusProcessExporterChart.namespace;
This program provisions a new EKS cluster with a managed node group using the specified instance type and desired capacity. It then sets up a Pulumi Kubernetes provider that uses the kubeconfig of the newly created EKS cluster. Finally, it deploys
prometheus-process-exporter
using the indicated Helm chart repository and chart version to the monitoring namespace.Refer to the following Pulumi documentation for more detail on the resources used:
- EKS Cluster resource: eks.Cluster
- Kubernetes Provider: k8s.Provider
- Helm Chart resource: k8s.helm.v3.Chart
Make sure to install the required Pulumi packages in your project before running
pulumi up
to apply the code:npm install @pulumi/pulumi @pulumi/aws @pulumi/eks @pulumi/kubernetes
Note that creating and managing cloud resources with Pulumi can incur costs, which are based on the AWS pricing policy for the EKS service and the EC2 instances you launch as part of your cluster.
After deploying, you can retrieve the kubeconfig and Helm chart information with the following commands:
pulumi stack output kubeconfig > kubeconfig.yaml pulumi stack output chart pulumi stack output chartNamespace
Use the
kubeconfig.yaml
to interact with your cluster via kubectl, and manage or monitor the Prometheus Process Exporter Helm chart deployment.- Create an EKS cluster: Utilize Pulumi's