Check CPU usage directly from the OpenShift command line
The fastest way to see how much CPU your nodes are using is the oc top nodes command. This shows you real CPU consumption on each machine in your cluster, updated every few seconds. You run it once from your terminal and get an when ready snapshot of what is happening right now.
Before you can use this command, you need the OpenShift metrics server running in your cluster — most installations include it by default, but if you get an error saying metrics are not available, your cluster administrator will need to enable it. Once metrics are active, the command works when ready.
The output shows each node's name, how much CPU it is actually using, how much memory it is using, and what percentage of the node's total capacity each represents. A node using 2 cores out of 4 available will show 50% CPU. This percentage tells you whether a node is close to its limit or has room for more workloads.
Key Takeaways
- Run oc top nodes from your terminal to see CPU usage on each machine in your cluster right now.
- The output shows both the raw CPU amount and the percentage of that node's total capacity being used.
- For individual containers, use oc top pods with a namespace flag to see which specific workloads are consuming the most CPU.
- The OpenShift web console shows CPU trends over time in graphs, which helps you spot patterns that a single snapshot cannot reveal.
- CPU requests and limits in your pod definitions control how much CPU OpenShift reserves and allows each workload to use.
Understanding what the CPU numbers mean
OpenShift measures CPU in millicores, where 1000 millicores equals 1 full CPU core. When you see a pod using 250m, that means it is using one quarter of a single core. This unit matters because it lets you be precise about how much processing power you are actually giving to each workload.
The percentage shown next to the CPU number tells you how much of that node's total capacity is in use. If a node has 4 cores and is using 1 core, that is 25%. If it climbs to 3.5 cores, that is 87.5%. Once a node hits 90% or higher, you are running close to the edge — any spike in demand could cause slowdowns or failed workloads.
Keep in mind that the CPU number you see is what the workload is actually consuming at that moment. This is different from the CPU request, which is what you told OpenShift to reserve for that workload, and the CPU limit, which is the maximum it is allowed to use. A pod might have a request of 500m but only be using 100m right now.
Check CPU usage for individual pods and containers
To see which specific pods are consuming the most CPU, use oc top pods. By default this shows pods in your current namespace, but you can add -n namespace-name to check a different one, or --all-namespaces to see everything running in the cluster.
The output lists each pod, its current CPU usage in millicores, its memory usage, and the percentage of the node's capacity it represents. If you have a pod using 2000m (2 full cores) and your node only has 4 cores total, that single pod is consuming half the machine's processing power. This is the fastest way to spot a workload that is hogging resources.
If you need to dig deeper into a specific pod and see which container inside it is using the most CPU, add the --containers flag to the command. This breaks down the usage by individual container, which matters when a pod runs multiple containers and you need to know which one is the problem.
Use the OpenShift web console to see CPU trends over time
The command line shows you a snapshot of right now. The OpenShift web console shows you what happened over the last hour, day, or week in graph form. This matters because a node might be using 40% CPU right now but spiking to 95% every afternoon at 2 PM — the snapshot would miss that pattern entirely.
To view these graphs, log into the OpenShift web console, navigate to the Nodes section, and click on the node you want to inspect. You will see CPU usage, memory usage, and network traffic displayed as line graphs. The time range selector at the top lets you zoom in on the last hour or zoom out to see the last week.
The same graphs are available for individual pods. Go to the Workloads section, find your pod, and the Details tab shows CPU and memory usage over time. If a pod is crashing repeatedly or performing poorly at certain times of day, these graphs often reveal the cause — a spike in CPU usage right before the crash, for example.
Set CPU requests and limits to prevent overload
Checking CPU usage is useful for spotting problems, but preventing them is better. You do this by setting CPU requests and limits in your pod definition. The request tells OpenShift how much CPU to reserve for that pod — the scheduler will not place the pod on a node unless that node has the requested amount available. The limit tells OpenShift the maximum CPU the pod is allowed to use.
If you set a request of 500m, OpenShift reserves half a core for that pod and will not schedule it on a node that does not have 500m free. If you set a limit of 1000m, the pod can use up to 1 full core but no more — if it tries to exceed that, OpenShift will throttle it, slowing it down. Without a limit, a runaway workload can consume all available CPU and starve other pods.
To add or change these values, edit your pod definition and add a resources section under the container specification. Include both requests and limits, measured in millicores. A typical web process might request 250m and limit to 500m. A database might request 1000m and limit to 2000m. The right numbers depend on what your workload actually needs, which you can discover by running it and checking the CPU usage graphs.
Investigate high CPU usage and find the cause
If you see a node or pod using more CPU than expected, start by checking whether the workload is actually doing what it should be doing. A pod using 3000m might be correct if it is running a data processing job, or it might be a sign of a bug if it is supposed to be idle. Check the process logs to see whether it is processing requests normally or stuck in a loop.
Next, compare the CPU usage to the CPU request and limit you set. If a pod is hitting its limit repeatedly, it is being throttled — increase the limit or move the pod to a node with more available capacity. If a pod is using far less than its request, you are wasting resources — lower the request so OpenShift can schedule other workloads on that space.
If the entire node is running hot, check whether you have too many pods scheduled on it. Use oc describe node node-name to see all the pods running on that node and their requested CPU. If the total requested CPU is close to the node's capacity, the node is full and you need to add more nodes to the cluster or move some workloads elsewhere.
Frequently Asked Questions
Why does oc top nodes show no data?
The metrics server is not running or not yet ready. Ask your cluster administrator to check that the metrics-server pod is running in the openshift-monitoring namespace. It can take a few minutes after installation before metrics start appearing, so wait a few minutes and try again.
Can I set CPU limits lower than CPU requests?
No. The limit must be equal to or higher than the request. If you set a request of 500m and a limit of 250m, OpenShift will reject the pod definition. The request is what you may provide the pod will get; the limit is the maximum it can use above that.
What happens if a pod exceeds its CPU limit?
OpenShift throttles the pod, slowing down its processing. The pod does not crash or get evicted — it just runs slower. If you see a pod consistently hitting its limit, increase the limit or move it to a less crowded node so it has room to use more CPU when it needs to.
How often does oc top update the numbers?
The metrics server collects data every 15 seconds, so the numbers you see are at most 15 seconds old. The web console graphs update every minute. For real-time monitoring of very fast changes, you would need a separate monitoring tool like Prometheus.
Can I check CPU usage for a pod that has already crashed?
No, oc top only shows running pods. Check the pod's logs with oc logs pod-name to see what happened before it crashed. If you need to see CPU usage from before the crash, check the web console graphs — they retain historical data even after a pod restarts.