Check CPU with the oc command line tool
The fastest way to see CPU usage on a single node is to run oc top node from your terminal. This command pulls real-time CPU and memory data directly from the metrics server running inside your cluster. You need cluster admin access or permissions to view node metrics.
Open your terminal and run this command:
oc top node node-name
Replace "node-name" with the actual name of the node you want to check. OpenShift will return the current CPU usage in millicores (m) and the percentage of total node capacity being used. For example, you might see "500m" which means 500 millicores, or "50%" of a 1-core node.
If you want to see all nodes at once, run oc top nodes without specifying a name. This shows every node in your cluster in a single table, making it easy to spot which nodes are under heavy load.
Key Takeaways
- The oc top node command shows real-time CPU usage for a single node and requires cluster admin permissions to run.
- CPU usage displays in millicores (m) and as a percentage of total node capacity, so a node showing 1000m on a 2-core system is at 50% utilization.
- Run oc top nodes without a node name to see CPU usage across your entire cluster at once.
- The metrics server must be running in your cluster for these commands to work; if you see "no metrics available," the server may not be installed.
- For detailed historical data and alerts, use the OpenShift web console or connect Prometheus to track CPU trends over time.
Understanding millicores and CPU percentages
OpenShift reports CPU in millicores, which is one-thousandth of a CPU core. A node with a single core can use up to 1000 millicores. If you see a pod using 250m, that is one-quarter of a single core.
The percentage shown next to the millicores tells you how much of that node's total CPU capacity is in use right now. A node with 4 cores showing "25%" means 1 core is actively being used. This percentage helps you quickly spot overloaded nodes without doing math in your head.
Keep in mind that oc top shows current usage only, not historical trends. If a node spiked to 90% CPU five minutes ago but is now at 20%, the command will only show you the 20%. For tracking patterns over time, you need to check the OpenShift web console or set up Prometheus monitoring.
Access the web console for a visual view
If you prefer not to use the command line, the OpenShift web console displays node CPU usage in a graphical format. Log into your cluster's web console, navigate to the Compute section, and select Nodes from the left menu.
Click on any node name to open its detail page. You will see a CPU usage graph that shows usage over the last hour by default. The graph updates every few seconds and gives you a quick visual sense of whether the node is stable, climbing, or spiking.
The web console also shows CPU requests and limits set on pods running on that node, which helps you understand why usage is high. A node might show 80% CPU because one pod requested a large amount of CPU, or because many small pods are running together.
Check if the metrics server is installed
If you run oc top node and see an error like "no metrics available" or "metrics not available," the metrics server is not running in your cluster. The metrics server is a separate component that collects CPU and memory data from all nodes.
To check if it is installed, run:
oc get deployment metrics-server -n openshift-monitoring
If the command returns "not found," the metrics server is not installed. Contact your cluster administrator to install it, as it is required for any CPU monitoring to work. Most OpenShift clusters have it installed by default, but some minimal or air-gapped installations may not.
If the deployment exists but shows 0 replicas, the metrics server is installed but not running. Run oc scale deployment metrics-server -n openshift-monitoring --replicas=1 to start it. After a few minutes, oc top node commands will begin returning data.
Monitor CPU usage over time with Prometheus
For production clusters, oc top is useful for quick checks but not for tracking trends or setting alerts. OpenShift includes Prometheus, a time-series database that stores metrics over days or weeks. You can query Prometheus directly to see how CPU usage has changed and set up alerts when usage exceeds a threshold.
Access Prometheus through the OpenShift web console by going to Observe > Metrics. In the query box, type node_cpu_seconds_total to see raw CPU data, or use a more readable query like 100 - (avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) to see idle percentage converted to usage percentage.
Prometheus queries take practice to write, but the web console includes a dropdown of common queries. If you are new to Prometheus, start by exploring the pre-built dashboards in the Observe section, which show node CPU alongside memory and network usage.
Troubleshoot high CPU usage on a node
Once you identify a node with high CPU usage, the next step is finding which pods are consuming the most CPU. Run:
oc top pod -n namespace-name --sort-by=cpu
Replace "namespace-name" with the actual namespace where your pods run. This command lists all pods in that namespace sorted by CPU usage, with the highest consumers at the top. If you want to see pods across all namespaces, add the --all-namespaces flag.
Once you find the pod using the most CPU, check its logs and resource requests. A pod might be using high CPU because it is misconfigured, running a resource-intensive task, or experiencing a bug. Check the pod's definition with oc describe pod pod-name -n namespace-name to see what CPU limits and requests are set. If the pod is allowed to use unlimited CPU, it will consume whatever is available.
Set CPU limits to prevent node overload
If you find that pods are consuming too much CPU and slowing down the node, you can set CPU limits in the pod's deployment definition. A CPU limit is the maximum amount of CPU a pod is allowed to use; if it tries to exceed the limit, the container is throttled.
Edit your deployment and add a resources section to the container spec:
This example limits the container to 500 millicores. If the container tries to use more, Kubernetes will throttle it. Set the limit based on what your application actually needs; too low a limit will make the app slow, and too high a limit defeats the purpose of protecting the node.
After you update the deployment, existing pods will not change. You need to restart them by deleting the old pods, which forces Kubernetes to create new ones with the new limits. Run oc delete pod -l app=your-app-name -n namespace-name to restart all pods with that label.
Frequently Asked Questions
What does it mean if CPU usage is 1500m on a 2-core node?
It means the node is using 1500 millicores out of 2000 available (2 cores × 1000m per core), which is 75% utilization. The node still has 500m of CPU available. If usage climbs above 2000m, the node is overloaded and pods will be throttled or evicted.
Why does oc top show different numbers than the web console?
The web console may show averaged or historical data, while oc top shows the current snapshot. If you run the command multiple times in quick succession, you might see slightly different numbers because CPU usage changes constantly. Both are pulling from the same metrics server, so large differences usually mean you are looking at different time windows.
Can I check CPU usage if I don't have cluster admin access?
No, viewing node metrics requires cluster admin or monitoring admin permissions. If you need to see CPU usage but don't have these permissions, ask your cluster administrator to grant you the monitoring-rules-edit or monitoring-edit role, or to check the metrics for you.
What happens if a pod exceeds its CPU limit?
The container is throttled, meaning the CPU scheduler slows down the process to keep it within the limit. The pod does not crash, but it will run slower. If you see pods running slowly and they are hitting their CPU limits, you can increase the limit or optimize the application to use less CPU.
Do I need to install anything extra to use oc top?
No, oc top is built into the OpenShift command line tool. You only need the metrics server running in your cluster, which is installed by default on most OpenShift deployments. If metrics are not available, contact your administrator to check whether the metrics server is running.