This lab uses the OpenShift web console to view CPU, memory, network and pod metrics for one namespace and its workloads. It then checks the same numbers from the CLI. The sections below add what the steps above leave out: how to enable monitoring on OpenShift Local, YAML for a web app and for the rpjob Job that oc logs job/rpjob expects, ready-to-run PromQL queries, expected output and fixes for common problems.
OpenShift Lab 10: View Pod, Workload, and Namespace Performance Metrics Using the OpenShift Web Console
Updated lab flow
- Start OpenShift Local.
- Log in to the web console.
- Create project
lab10-performance-demo. - Deploy a lightweight web app or resource-pressure Job.
- View pods and workload details in Topology.
- Open Observe โ Dashboards.
- Select dashboard:
Kubernetes / Compute Resources / Namespace (Workloads) - View CPU, memory, network receive/transmit, pod count, and workload metrics.
- Use Observe โ Metrics to run simple PromQL queries.
- Validate from CLI using:
oc get pods
oc get jobs
oc logs job/rpjob
oc adm top pods
Code language: JavaScript (javascript)
- Explain why metrics may take 30โ60 seconds to appear.
- Clean up the project.
One important update: Red Hatโs monitoring docs note that from OpenShift 4.19 onward, the web console perspectives changed and the Developer perspective is no longer enabled by default in the same way, so our lab should avoid depending too heavily on old Developer Sandbox screenshots. We can still mention Developer/Administrator views, but we should write the steps flexibly for the current console. (Red Hat Documentation)
Before you start: enable cluster monitoring on OpenShift Local
OpenShift Local (CRC) turns off the cluster monitoring stack by default to save memory. If it stays off, Observe โ Dashboards and Observe โ Metrics show no data, and oc adm top pods reports that metrics are not available. Monitoring needs more memory than the default setting, so give the VM at least 14 GiB before you start it.
- OpenShift Local installed with the
openshiftpreset (MicroShift does not include this console monitoring stack). - A host with enough free RAM for a 14 GiB VM, and at least 4 vCPUs.
- The
ocCLI.crc oc-envgives you one.
# Stop the instance if it is running
crc stop
# Enable monitoring and give the VM enough memory (value in MiB)
crc config set enable-cluster-monitoring true
crc config set memory 14336
# Start the cluster and put oc on your PATH
crc start
eval $(crc oc-env)
# Show console URL and login credentials
crc console --credentials
# Log in as the developer user
oc login -u developer -p developer https://api.crc.testing:6443Code language: PHP (php)
Note: After crc start, the monitoring pods can take a few minutes to become ready. To check them, log in as kubeadmin and run oc get pods -n openshift-monitoring. Wait until the prometheus-k8s-* and thanos-querier-* pods are Running.
Create the project and deploy workloads
Step 4 above offers a choice between a web app and a resource-pressure Job. Deploy both. The web app gives you network traffic and a steady low baseline. The Job, named rpjob to match the oc logs job/rpjob command above, uses CPU for five minutes so the graphs have something to show.
oc new-project lab10-performance-demo
# Lightweight web app (UBI httpd listens on 8080)
oc create deployment web --image=registry.access.redhat.com/ubi9/httpd-24 --port=8080
oc set resources deployment/web --requests=cpu=50m,memory=64Mi --limits=cpu=200m,memory=256Mi
oc expose deployment web --port=8080
oc expose service web
oc get route webCode language: PHP (php)
Save the following as rpjob.yaml. The container runs a busy loop that is capped by its CPU limit, so it pushes CPU usage up to about 500m without affecting the rest of the cluster. The securityContext meets the restricted pod security profile, so OpenShift does not show admission warnings.
apiVersion: batch/v1
kind: Job
metadata:
name: rpjob
spec:
backoffLimit: 0
ttlSecondsAfterFinished: 1800
template:
spec:
restartPolicy: Never
containers:
- name: cpu-burn
image: registry.access.redhat.com/ubi9/ubi-minimal
command: ["bash", "-c"]
args:
- |
echo "rpjob: starting 300s CPU load"
end=$((SECONDS+300))
while [ $SECONDS -lt $end ]; do :; done
echo "rpjob: finished"
resources:
requests:
cpu: 100m
memory: 32Mi
limits:
cpu: 500m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefaultCode language: PHP (php)
oc apply -f rpjob.yaml
# Generate some HTTP traffic for the network panels
HOST=$(oc get route web -o jsonpath='{.spec.host}')
for i in $(seq 1 500); do curl -s -o /dev/null http://$HOST/; doneCode language: PHP (php)
In Topology, select the web Deployment and the rpjob Job. The side panel shows the pod status. Open a pod and go to its Metrics tab for small CPU, memory and network graphs for that pod. For more on Job fields such as backoffLimit and ttlSecondsAfterFinished, see Kubernetes Job & CronJob Explained.
Reading the namespace workloads dashboard
Open Observe โ Dashboards, select the project lab10-performance-demo if asked, and choose Kubernetes / Compute Resources / Namespace (Workloads). Set the time range to the last 15 or 30 minutes. Where the dashboard has a workload type filter, set it to deployment or job. The menu location depends on your console version and perspective: from OpenShift 4.19 onward, look for Observe in the main navigation rather than relying on the older Developer perspective layout.
| Panel | What it shows | What to expect in this lab |
|---|---|---|
| CPU Usage | CPU cores used per workload over time | rpjob near 0.5 cores while it runs, web close to 0 |
| CPU Quota | Usage compared with requests and limits | rpjob usage well above its 100m request and at its 500m limit |
| Memory Usage | Working set memory per workload | web tens of MiB, rpjob only a few MiB |
| Memory Quota | Memory usage compared with requests and limits | Both well under their limits |
| Receive / Transmit Bandwidth | Network bytes per second per workload | A short spike on web while the curl loop runs |
| Running pods | Number of pods per workload | 1 for web, 1 for rpjob until it completes |
Query metrics with PromQL in Observe โ Metrics
Observe โ Metrics runs PromQL against the cluster Prometheus through Thanos Querier. If you are not a cluster admin, results are limited to the project you select, so make sure lab10-performance-demo is the active project. Paste each query and click Run queries.
# CPU cores used per pod (5-minute rate)
sum by (pod) (rate(container_cpu_usage_seconds_total{namespace="lab10-performance-demo", container!="", container!="POD"}[5m]))
# Memory working set per pod, in bytes
sum by (pod) (container_memory_working_set_bytes{namespace="lab10-performance-demo", container!="", container!="POD"})
# Network receive bytes per second per pod
sum by (pod) (rate(container_network_receive_bytes_total{namespace="lab10-performance-demo"}[5m]))
# Pod count by phase
sum by (phase) (kube_pod_status_phase{namespace="lab10-performance-demo"})Code language: PHP (php)
The container!="" filter drops the pod-level cgroup series. Without it, the totals count the same CPU twice. rate(...[5m]) turns a counter that only increases into a per-second value. A shorter window such as [1m] reacts faster but gives a noisier line.
Validate from the CLI
oc project lab10-performance-demo
oc get pods
oc get jobs
oc logs job/rpjob
oc adm top podsCode language: JavaScript (javascript)
While the Job is running, the output looks similar to the example below. Pod name suffixes and exact values will differ.
$ oc get jobs
NAME STATUS COMPLETIONS DURATION AGE
rpjob Running 0/1 2m10s 2m10s
$ oc logs job/rpjob
rpjob: starting 300s CPU load
$ oc adm top pods
NAME CPU(cores) MEMORY(bytes)
rpjob-7xk2p 499m 1Mi
web-6d9c8b7f5d-q4lmn 1m 38MiCode language: JavaScript (javascript)
oc adm top pods reads the Kubernetes metrics API (metrics.k8s.io), not Prometheus directly, so its numbers will be close to the dashboard but may not match exactly. Once the Job completes, oc get jobs reports it as complete and the pod drops out of oc adm top output.
Why metrics take 30 to 60 seconds to appear
- Scrape interval: Prometheus collects container metrics from the kubelet on a fixed schedule, usually about every 30 seconds. A new pod has no data until its first scrape.
- Rate needs two samples: CPU and network graphs use
rate(), which needs at least two data points. That can add another full scrape interval. - Metrics API window:
oc adm topreports usage averaged over a recent window, so new pods showmetrics not available yetat first. - Dashboard refresh: The console polls on its own refresh interval. Click refresh or shorten the interval if a graph looks stale.
Common problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
Dashboards show No datapoints found | Cluster monitoring is turned off in OpenShift Local | Run crc config set enable-cluster-monitoring true, set memory to 14336, then restart |
error: metrics not available yet from oc adm top pods | Pods are too new, or monitoring is not running | Wait a minute and retry, then check pods in openshift-monitoring |
| Observe menu or dashboard not visible | Console perspective changed, or your user lacks permission | Look for Observe in the main navigation, select the correct project, and log in as a user with access to the project |
| PromQL returns nothing for a developer user | No project selected, or wrong namespace label | Select lab10-performance-demo and check the namespace value in the query |
rpjob pod stuck in Pending | Not enough CPU or memory to schedule it | Run oc describe pod, then lower requests or give CRC more CPUs with crc config set cpus 6 |
| Pod security warnings when applying YAML | Missing restricted securityContext fields | Use the securityContext from the manifest above |
Clean up
oc delete project lab10-performance-demo
# Optional: stop the cluster to free host memory
crc stopCode language: PHP (php)
Deleting the project removes the Deployment, Service, Route and Job together. Historical metrics for the namespace stay in Prometheus until normal retention removes them.
Corrections to the lab flow above
- The flow runs
oc logs job/rpjobbut never creates a Job namedrpjob. The manifest above defines it. - Steps 1 to 4 contain no commands. Commands to start CRC, log in, create the project and deploy workloads are added above.
- OpenShift Local turns off cluster monitoring by default, so the dashboards and
oc adm topshow no data unless you enable it and raise the VM memory first. - The CLI validation commands assume the lab project is active. Run
oc project lab10-performance-demofirst or add-n lab10-performance-demo.
Frequently asked questions
Why does the OpenShift Local console show no metrics?
OpenShift Local turns off cluster monitoring by default. Run crc config set enable-cluster-monitoring true, give the VM at least 14 GiB of memory, and restart the cluster.
What is the difference between oc adm top pods and the Observe dashboards?
oc adm top pods shows the current usage from the Kubernetes metrics API. The Observe dashboards query Prometheus history, so you can see trends, compare usage with requests and limits, and view network traffic.
Can a non-admin user view namespace metrics in OpenShift?
Yes. A user with access to a project can open Observe dashboards and run PromQL queries limited to that project. Cluster-wide queries need extra monitoring permissions.
Which dashboard shows CPU and memory per Deployment in OpenShift?
Use Kubernetes / Compute Resources / Namespace (Workloads). It groups usage by workload, such as Deployment, StatefulSet or Job, and compares it with requests and limits.
Why does my new pod not appear in the metrics graphs right away?
Prometheus scrapes container metrics on an interval, usually about 30 seconds, and rate-based graphs need at least two samples. A delay of up to about a minute is normal.
Related tutorials
- Kubernetes Job & CronJob Explained: API Resource, YAML Example, and Use Cases
- OpenShift Lab 13: Deploy a Java Spring Boot Application with MySQL Using the OpenShift Web Console
- Troubleshooting Guide to Resolving 500 Errors in Kubernetes Production Environments
- More OpenShift tutorials
- More Kubernetes tutorials
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services โ all in one place.
Explore Hospitals
The OpenShift web console makes performance checks easier when teams know which metrics matter most. Watching CPU and memory use alongside pod restarts can help identify resource pressure early. It is useful to compare current readings with normal workload patterns instead of reacting to a single spike. Teams should also check resource requests and limits when a pod consistently runs near capacity. Recording findings during the lab builds good habits for diagnosing performance issues in real clusters.
Very helpful and practical guide! The steps to view performance information using the OpenShift web console are explained clearly, making it easier for beginners and admins to monitor cluster metrics and resource usage. A useful resource for anyone learning OpenShift management.