Sunday, September 27, 2020

Monitoring Tanzu Kubernetes cluster using Prometheus and Grafana

Updated: June 26, 2021

In this post, we will see how to deploy Prometheus and Grafana using Helm and Prometheus Operator to monitor Tanzu Kubernetes clusters. 


Following is my Tanzu K8s cluster setup:


Install Helm 3

curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get-helm-3 > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh

Install Prometheus Operator using Helm

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install pro-mon -n pro-mon prometheus-community/kube-prometheus-stack


Verify all


Port forward Grafana to 3000 to access the dashboards


Login to Grafana using a web browser at localhost:3000/login .

The default username is "admin" and the password is "prom-operator".


Go to Dashboards - Manage to view/ access the list of out-of-the-box K8s dashboards. The following are some of the sample dashboards.


Kubernetes | Compute Resources | Namespace (Pods)


Kubernetes | Networking | Namespace (Pods)


Kubernetes | API server


This is not limited to just Tanzu K8s clusters. You can also monitor OpenShift and Upstream K8s clusters following this method. Hope it was useful. Cheers!

References


https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack
[www.bogotobogo.com] Docker_Kubernetes_Prometheus_Deploy_using_Helm_and_Prometheus_Operator

Saturday, September 19, 2020

Performance monitoring in Linux

CPU

cd /proc/

cat cpuinfo

less cpuinfo

less cpuinfo | grep processor

uptime

The load average is the CPU usage load average over 1 min, 5 min, and 15 min. The calculation for load avg value is given below.

For a single processor system:

Load avg value 1.0 = 100% CPU capacity usage

Load avg value 0.5 = 50% CPU capacity usage


This means for a 4 processor system:

Load avg value 4.0 = 100% CPU capacity usage

Load avg value 2.0 = 50% CPU capacity usage

Load avg value 1.0 = 25% CPU capacity usage


top

To get details of a process: ps aux | grep <process ID>

To get logs of a process: journalctl _PID=<process ID>


Memory


cat /proc/meminfo
less /proc/meminfo


free -h


Average memory usage view by samples with regular intervals: 

vmstat <interval> <number of samples>

Hope it was useful. Cheers!