Monitor Kubernetes with Prometheus
words - read.

Monitor Kubernetes with Prometheus

Prometheus is a monitoring tool originally created by SoundCloud. The project is now part of the Cloud Native Computing Foundation. Prometheus is very useful to monitor your Kubernetes infrastructure as well as your workload running in your Kubernetes cluster.

prometheus logo

Prerequisites

The only prerequisite for this lab is a working Kubernetes cluster.

Installation of Prometheus

To deploy Prometheus in our Kubernetes cluster, we will use a project developed by CoreOS called Prometheus Operator.

1- Clone the Prometheus Operator GitHub project.

$ git clone -b release-0.18 https://github.com/coreos/prometheus-operator.git

2- Go to the prometheus-operator/contrib/kube-prometheus directory.

$ cd prometheus-operator/contrib/kube-prometheus

3- Deploy Prometheus.

$ ./hack/cluster-monitoring/deploy

Access the Prometheus dashboard

Prometheus is exposed via a nodePort service.

1- Get the port of the service.

$ kubectl get svc -n monitoring -l prometheus=k8s
NAME             TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
prometheus-k8s   NodePort   10.32.0.158           9090:30900/TCP   2m

In my case, the Prometheus nodeport is 30900.

2- Browse to http://[one_of_your_node_ip]:[prometheus_nodeport].

prometheus dashboard

Access the Prometheus Grafana dashboard.

As for the Prometheus dashboard, the Grafana dashboard is also exposed via a nodeport service.

1- Get the port of the service.

$ kubectl get svc -n monitoring -l app=grafana
NAME      TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
grafana   NodePort   10.32.0.251           3000:30902/TCP   17m

In my case, the Grafana nodeport is 30902.

2- Browse to http://[one_of_your_node_ip]:[grafana_nodeport].

prometheus grafana dashboard

3- Display the various dashboards.

prometheus grafana dashboard

prometheus grafana dashboard

prometheus grafana dashboard

Comments

comments powered by Disqus