Skip to main content
Version: 1.17.0

Install Prometheus

Prometheus is an open-source systems monitoring and alerting tool that collects and stores metric information along with the timestamp. These metrics can be viewed using the KubeSlice Manager dashboard. To view the metrics on the dashboard, Prometheus must be installed on the worker clusters.

info

If you already have Prometheus installed on the worker cluster, you can skip this step.

To install Prometheus from the helm repo:

  1. Create the monitoring namespace using the following command:

    kubectl create ns monitoring
  2. Install Prometheus using the following command:

    helm install prometheus kubeslice/prometheus -n monitoring

Validate the Installation

Validate the installation of Prometheus by checking the status of the pods. Use the following command to check if the pods are running:

kubectl get pods -n monitoring

Example Output

NAME                                             READY   STATUS    RESTARTS   AGE
prometheus-kube-state-metrics-84bb75bf7d-lwvsw 1/1 Running 0 58s
prometheus-prometheus-node-exporter-2xzkq 1/1 Running 0 59s
prometheus-server-67849fdd9b-qh7pn 2/2 Running 0 59s

Get the Prometheus URL

Use the following command to get the external IP address of the cluster:

kubectl get nodes -o wide

Example Output

NAME                                               STATUS   ROLES    AGE   VERSION             INTERNAL-IP   EXTERNAL-IP     OS-IMAGE                             KERNEL-VERSION   CONTAINER-RUNTIME
gke-stack-1-stack-1-main-pool-7b4ad25d-ppdg Ready <none> 60s v1.20.15-gke.5000 10.6.0.4 34.145.38.195 Container-Optimized OS from Google 5.4.170+ containerd://1.4.8

From the above output, get the external IP address of any one node. For example, 34.145.38.195 is the external IP address of a node.

Use the following command to get the NodePort:

kubectl get svc -n monitoring | grep prometheus-server

Example Output

prometheus-server      NodePort    34.145.38.195   <none>        80:32700/TCP   11m

The Prometheus URL is in the http://<ExternalNodeIp>:<port> format. For example, http://34.145.38.195:32700 is the Prometheus URL.

info

If the prefix http:// or https:// is not added for the Prometheus URL during the worker cluster registration, then the default prefix http:// is applied to the Prometheus URL.