Lab 13.4 - Grafana and Prometheus

1. Get the Prometheus host and port

oc login -u admin -p rahasia https://api.openshift.podX.io:6443
oc -n openshift-monitoring get routes

2. Accessing Prometheus via https://prometheus-k8s-openshift-monitoring.apps.openshift.podX.io/

3. The default, it shown graph tab. In Expression field, type:

avg(container_memory_working_set_bytes{namespace='openshift-monitoring'}) BY (pod)

Click Execute. And review the result

4. Click Status → Targets

Notice that the target is UP

5. Get the Grafana host and port

oc -n openshift-monitoring get routes

6. If you want to directly from the OKD web console, click Monitoring → Grafana UI

This will access the URL https://grafana-openshift-monitoring.apps.openshift.podX.io/

7. Log in as the admin user

8. Select Home → Defaults → Kubernetes / Compute Resources / Workload

  • datasource: prometheus
  • namespace: console-apps
  • workload: books
  • type: deployment

Review the workload the workload's CPU, memory, and disk usage.

Daftar Materi