Kubernetes cluster monitoring.
create namespaces monitoring
[root@k8s-master1]# kubectl create ns monitoring namespace/monitoring created
Prometheus Deployment
[root@k8s-master1 kubernetes-prometheus]# kubectl create -f . clusterrole.rbac.authorization.k8s.io/prometheus created clusterrolebinding.rbac.authorization.k8s.io/prometheus created configmap/prometheus-server-conf created deployment.apps/prometheus-deployment created service/prometheus-service created
Grafana Deployment
[root@k8s-master1 kubernetes-grafana]# kubectl create -f . deployment.apps/grafana created configmap/grafana-datasources created service/grafana created
Pods must be left in runing
[root@k8s-master1 ~]# kubectl get pods -n monitoring NAME READY STATUS RESTARTS AGE grafana-548fdc7598-ns6kr 1/1 Running 0 37s prometheus-deployment-54686956bd-hvcjj 1/1 Running 0 6m59s
Services must be in NodePort
[root@k8s-master1 ~]# kubectl get svc -n monitoring NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE grafana NodePort 10.111.45.132 3000:32150/TCP 51s prometheus-service NodePort 10.105.135.187 8080:32100/TCP 7m13s
We enter the grafana url, your IP
http://$IP:32150/
We cook Grafana with the database
We import the Dashboard kubernetes-cluster-monitoring-via-prometheus_rev3.json
Note: On the official Grafana page we can download the Dashboard that we want
Revisa el tablero
pod review in detail