This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.5.2. Verifying node health
Review cluster node health status, resource consumption statistics, and node logs. Additionally, query kubelet status on individual nodes.
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole. -
You have installed the OpenShift CLI (
oc).
Procedure
List the name, status, and role for all nodes in the cluster:
oc get nodes
$ oc get nodesCopy to Clipboard Copied! Toggle word wrap Toggle overflow Summarize CPU and memory usage for each node within the cluster:
oc adm top nodes
$ oc adm top nodesCopy to Clipboard Copied! Toggle word wrap Toggle overflow Summarize CPU and memory usage for a specific node:
oc adm top node -l my-node
$ oc adm top node -l my-nodeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2.2. Querying the kubelet’s status on a node 复制链接链接已复制到粘贴板!
You can review cluster node health status, resource consumption statistics, and node logs. Additionally, you can query kubelet status on individual nodes.
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc).
Procedure
The kubelet is managed using a systemd service on each node. Review the kubelet’s status by querying the
kubeletsystemd service within a debug pod.Start a debug pod for a node:
oc debug node/my-node
$ oc debug node/my-nodeCopy to Clipboard Copied! Toggle word wrap Toggle overflow Set
/hostas the root directory within the debug shell. The debug pod mounts the host’s root file system in/hostwithin the pod. By changing the root directory to/host, you can run binaries contained in the host’s executable paths:chroot /host
# chroot /hostCopy to Clipboard Copied! Toggle word wrap Toggle overflow 注意OpenShift Container Platform cluster nodes running Red Hat Enterprise Linux CoreOS (RHCOS) are immutable and rely on Operators to apply cluster changes. Accessing cluster nodes using SSH is not recommended and nodes will be tainted as accessed. However, if the OpenShift Container Platform API is not available, or
kubeletis not properly functioning on the target node,ocoperations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>instead.Check whether the
kubeletsystemd service is active on the node:systemctl is-active kubelet
# systemctl is-active kubeletCopy to Clipboard Copied! Toggle word wrap Toggle overflow Output a more detailed
kubelet.servicestatus summary:systemctl status kubelet
# systemctl status kubeletCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2.3. Querying cluster node journal logs 复制链接链接已复制到粘贴板!
You can gather journald unit logs and other logs within /var/log on individual cluster nodes.
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc). - You have SSH access to your hosts.
Procedure
Query
kubeletjournaldunit logs from OpenShift Container Platform cluster nodes. The following example queries master nodes only:oc adm node-logs --role=master -u kubelet
$ oc adm node-logs --role=master -u kubelet1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
kubeletas appropriate to query other unit logs.
Collect logs from specific subdirectories under
/var/log/on cluster nodes.Retrieve a list of logs contained within a
/var/log/subdirectory. The following example lists files in/var/log/openshift-apiserver/on all master nodes:oc adm node-logs --role=master --path=openshift-apiserver
$ oc adm node-logs --role=master --path=openshift-apiserverCopy to Clipboard Copied! Toggle word wrap Toggle overflow Inspect a specific log within a
/var/log/subdirectory. The following example outputs/var/log/openshift-apiserver/audit.logcontents from all master nodes:oc adm node-logs --role=master --path=openshift-apiserver/audit.log
$ oc adm node-logs --role=master --path=openshift-apiserver/audit.logCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs on each node using SSH instead. The following example tails
/var/log/openshift-apiserver/audit.log:ssh core@<master-node>.<cluster_name>.<base_domain> sudo tail -f /var/log/openshift-apiserver/audit.log
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo tail -f /var/log/openshift-apiserver/audit.logCopy to Clipboard Copied! Toggle word wrap Toggle overflow 注意OpenShift Container Platform 4.5 cluster nodes running Red Hat Enterprise Linux CoreOS (RHCOS) are immutable and rely on Operators to apply cluster changes. Accessing cluster nodes using SSH is not recommended and nodes will be tainted as accessed. Before attempting to collect diagnostic data over SSH, review whether the data collected by running
oc adm must gatherand otheroccommands is sufficient instead. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,ocoperations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>.