Prometheus Integration with kubernets using helm
In this hands on we are going to install helm and run the prometheus using helm chart
Helm is a package manager for Kubernetes. Helm is the K8s equivalent of yum or apt. Helm deploys charts, which you can think of as a packaged application.
Installation of helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
export PATH=$PATH:/usr/local/bin/
chmod 700 get_helm.sh
./get_helm.sh
helm version
If version is not visible
export PATH=$PATH:/usr/local/bin/helm
helm version
check the repository
helm repo list
Add the repo of helm chart using below command
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm search repo prometheus-community
helm repo list
choose and select the stack from there
For our use case we are using : prometheus-community/prometheus
Note : create a namespaces before installing the stack
kubectl create ns <namespacename>
kubectl create ns prometheus
helm install <releasename> prometheus-community/prometheus -n <namespace>
helm install prometheus prometheus-community/prometheus -n prometheus
Once the chart is installed, you can check the with following commands:
helm list -n <namespace>
kubectl get svc -n <namespace>
kubectl get pods -n <namespace>
kubectl get deployment -n <namespace>
Make sure all pod deployment are up and running
Since prometheus services are available within a cluster (ClusterIP is the default Kubernetes service), therefore they can not be accessed outside of cluster.
In order to access the web GUI from outside of cluster,
Kubernetes transparently routes incoming traffic on the loadbalancer or NodePort to your service
expose the alertmanager and prometheus server via loadbalancer to view the UI
NAME TYPE EXTERNAL-IP PORT(S) AGE
prometheus-alertmanager LoadBalance aba43a44c82744a548f6d45797641124–1001200644.ap-south-1.elb.amazonaws.com 80:32490/TCP 22h
prometheus-kube-state-metrics ClusterIP <none> 8080/TCP 22h
prometheus-node-exporter ClusterIP <none> 9100/TCP 22h
prometheus-pushgateway ClusterIP <none> 9091/TCP 22h
prometheus-server LoadBalance a496936c2e45649a18b31256efc067b3–2049612356.ap-south-1.elb.amazonaws.com 80:31206/TCP 22h
Congratulation we successfully integrate the Prometheus using helm on eks
Troubleshooting
1)if pods are not up : please check the nodes or increase the node
2)check the logs of pods , nodes
3)describe the pods, deployment , pvc , to check the events where it is stuck
example
kubectl describe pod podname -n <namespace>
4)any error messages which is in encoded form please use below query to decode
aws sts decode-authorization-message — encoded-message <error message> — query DecodedMessage — output text | jq ‘.’
Thank you