Configuring Prometheus and Grafana on EKS Cluster using Helm Chart
Kubernetes Monitor with Grafana & Prometheus
Before starting this blog I want to say that I’m not a Kubernetes expert, so if there are any mistakes in this blog, please let me know. It’s aimed at beginners learning Kubernetes.
I won’t delve into Kubernetes concepts here. My main aim is to help you set up Grafana and Prometheus in an AWS Kubernetes cluster. To make it easier, I’ll be using Helm. Helm provides templates that save us from the hassle of configuring everything from scratch.
AWS K8 Cluster Setup
First Create a Kubernetes cluster in AWS.
For that, I am planning to use eksctl tool to create a cluster. Please use these instructions to install the eksctl tool.
First Create the sample specification for the cluster using a configuration file.
Then Using following command can create EKS cluster successfully.
Note: When create eks instance using helm it is first time adding the user permission to config maps. for that follow these steps then it will display the cluster details in console.
Install Helm and Grafana Stack
Let’s see why we need helm to install grafana stack in Kubernetes. The main Advantage is helm gives the template-based configurations to install and manage complex Kubernetes applications.
First needs to install helm onto your local machine. After that add Prometheus repository to the helm.
Then Install the Prometheus Stack in K8 Cluster.
It will successfully create the deployment.
created pods
all the deployments
Inside the kube-prometheus-stack, Prometheus server, alert manager, and grafana will be available as a bundle.
Deploy Spring Boot Application And Monitor Via Grafana
In the next part, we are going to deploy a spring boot application and monitor using the grafana dashboard.
These things needs to consider when writing the spring boot application.
- Make sure to use the spring actuator to expose administrative endpoints for access via Prometheus.
2. Create Docker Image Repository in ECR and give the correct permissions to the AWS user.
Then we can easily deploy the Docker image to eks cluster.
And the final step is to expose the grafana dashboard to the public.
Before that, we can verify the grafana instance is up or not by using port forward.
This will helps to test the Grafana locally. These are the default credentials for the admin users.
user: admin
pass: prom-operator
Then you can view the cluster matrix via grafana.
Summarize
In this article, we have discussed how to create k8 cluster and deploy the grafana, Prometheus stack using helm and finally deploy custom created docker image. Then we have to monitor the cluster information and other custom-created matrices using the Grafana dashboard.