Thursday, August 31, 2023

PROMETHEUS | GRAFANA DASHBOARD FOR KUBERNETES MONITORING

 



A Prometheus Grafana dashboard for Kubernetes monitoring is a collection of visualizations and metrics that provide insights into the health and performance of a Kubernetes cluster. Prometheus is a popular open-source monitoring and alerting toolkit, while Grafana is a powerful data visualization and analytics platform.

CREATE KUBERNETES CLUSTER IN AWS USING EKSCTL:

Apply the command.
let’s create a Kubernetes cluster using eksctl.
eksctl create cluster --name test-cluster-1 --version 1.22 --region eu-central-1 --nodegroup-name worker-nodes 2--node-type t2.large --nodes 2 --nodes-min 2 --nodes-max 3

CLUSTER:

PODS:

INSTANCES:

RESOURCES:

CLUSTER NODES:

 

KUBERNETES METRICS SERVER:

Kubernetes Metrics Server is a component in the Kubernetes ecosystem that collects resource utilization data from the nodes and pods running in a cluster. It provides valuable insights into the performance and health of the cluster by exposing various metrics such as CPU and memory usage, network statistics, and file system usage.

Metrics Server retrieves data by communicating with the kubelet, which is an agent running on each node in the cluster. The kubelet collects resource usage information from containers and exposes it to the Metrics Server through an API.

Once the Metrics Server collects the metrics from all the nodes and pods, it stores and aggregates the data, making it available for querying and monitoring. This enables cluster administrators and developers to gain visibility into the resource consumption and efficiency of their applications, aiding in capacity planning, troubleshooting, and optimizing the overall performance of the cluster.

The collected metrics can be accessed using the Kubernetes Metrics API, which provides a standardized way to retrieve metric data for pods, nodes, and other Kubernetes resources. These metrics can be used for auto-scaling, generating custom monitoring dashboards, or integrating with other monitoring and alerting tools.

It is worth noting that the Kubernetes Metrics Server is a core component of the Kubernetes ecosystem, and it is often a prerequisite for deploying other monitoring and observability solutions, such as Prometheus and Grafana, to gain more advanced metrics analysis and visualization capabilities.

Kubernetes Metrics server collects the resource metrics from kubelets and exposes it to the Kubernetes api server through Metrics API for use by Horizontal Pod Autoscaler and Vertical Pod Autoscaler.

installation of Kubernetes metrics server

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
 

 

Verify the Kubernetes metric server installation:

kubectl get po -n kube-system
kubectl get deployment -n kube-system 


VERIFICATION ON AWS CLUSTER:

 

 

INSTALL PROMETHEUS

Add Prometheus repo into helm chart repository

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts 

helm repo update 

helm repo list

kubectl create namespace prometheus
 
helm install prometheus prometheus-community/prometheus --namespace prometheus --set alertmanager.persistentVolume.storageClass="gp2" --set server.persistentVolume.storageClass="gp2"
 
 
kubectl get all -n prometheus
 

 

INSTALL GRAFANA

helm repo add grafana https://grafana.github.io/helm-charts 
helm repo updat
 
 
helm install grafana grafana/grafana --namespace grafana --set persistence.storageClassName="gp2" --set persistence.enabled=true --set adminPassword='EKS!sAWSome' --values prometheus-datasource.yml --set service.type=LoadBalancer
  

kubectl get all -n grafana
 
 

GRAFANA EXTERNAL IP:

 
 ad1236857ff504792a9e5bf46b6fc50b-717297901.us-east-1.elb.amazonaws.com

IMPORT GRAFANA DASHBOARD FROM GRAFANA LABS:

 
Get template from Grafana – lab :
 

———————–


End Of Noted, Have a Good Weekend!

No comments:

Post a Comment