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.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 5. Troubleshooting
5.1. Troubleshooting installations Copia collegamentoCollegamento copiato negli appunti!
5.1.1. Determining where installation issues occur Copia collegamentoCollegamento copiato negli appunti!
When troubleshooting OpenShift Container Platform installation issues, you can monitor installation logs to determine at which stage issues occur. Then, retrieve diagnostic data relevant to that stage.
OpenShift Container Platform installation proceeds through the following stages:
- Ignition configuration files are created.
- The bootstrap machine boots and starts hosting the remote resources required for the master machines to boot.
- The master machines fetch the remote resources from the bootstrap machine and finish booting.
- The master machines use the bootstrap machine to form an etcd cluster.
- The bootstrap machine starts a temporary Kubernetes control plane using the new etcd cluster.
- The temporary control plane schedules the production control plane to the master machines.
- The temporary control plane shuts down and passes control to the production control plane.
- The bootstrap machine adds OpenShift Container Platform components into the production control plane.
- The installation program shuts down the bootstrap machine.
- The control plane sets up the worker nodes.
- The control plane installs additional services in the form of a set of Operators.
- The cluster downloads and configures remaining components needed for the day-to-day operation, including the creation of worker machines in supported environments.
5.1.2. User-provisioned infrastructure installation considerations Copia collegamentoCollegamento copiato negli appunti!
The default installation method uses installer-provisioned infrastructure. With installer-provisioned infrastructure clusters, OpenShift Container Platform manages all aspects of the cluster, including the operating system itself. If possible, use this feature to avoid having to provision and maintain the cluster infrastructure.
You can alternatively install OpenShift Container Platform 4.5 on infrastructure that you provide. If you use this installation method, follow user-provisioned infrastructure installation documentation carefully. Additionally, review the following considerations before the installation:
- Check the Red Hat Enterprise Linux (RHEL) Ecosystem to determine the level of Red Hat Enterprise Linux CoreOS (RHCOS) support provided for your chosen server hardware or virtualization technology.
- Many virtualization and cloud environments require agents to be installed on guest operating systems. Ensure that these agents are installed as a containerized workload deployed through a daemon set.
Install cloud provider integration if you want to enable features such as dynamic storage, on-demand service routing, node host name to Kubernetes host name resolution, and cluster autoscaling.
NoteIt is not possible to enable cloud provider integration in OpenShift Container Platform environments that mix resources from different cloud providers, or that span multiple physical or virtual platforms. The node life cycle controller will not allow nodes that are external to the existing provider to be added to a cluster, and it is not possible to specify more than one cloud provider integration.
- A provider-specific Machine API implementation is required if you want to use machine sets or autoscaling to automatically provision OpenShift Container Platform cluster nodes.
- Check whether your chosen cloud provider offers a method to inject Ignition configuration files into hosts as part of their initial deployment. If they do not, you will need to host Ignition configuration files by using an HTTP server. The steps taken to troubleshoot Ignition configuration file issues will differ depending on which of these two methods is deployed.
- Storage needs to be manually provisioned if you want to leverage optional framework components such as the embedded container registry, ElasticSearch, or Prometheus. Default storage classes are not defined in user-provisioned infrastructure installations unless explicitly configured.
- A load balancer is required to distribute API requests across all master nodes in highly available OpenShift Container Platform environments. You can use any TCP-based load balancing solution that meets OpenShift Container Platform DNS routing and port requirements.
5.1.3. Checking a load balancer configuration before OpenShift Container Platform installation Copia collegamentoCollegamento copiato negli appunti!
Check your load balancer configuration prior to starting an OpenShift Container Platform installation.
Prerequisites
- You have configured an external load balancer of your choosing, in preparation for an OpenShift Container Platform installation. The following example is based on a Red Hat Enterprise Linux (RHEL) host using HAProxy to provide load balancing services to a cluster.
- You have configured DNS in preparation for an OpenShift Container Platform installation.
- You have SSH access to your load balancer.
Procedure
Check that the
haproxy
systemd service is active:ssh <user_name>@<load_balancer> systemctl status haproxy
$ ssh <user_name>@<load_balancer> systemctl status haproxy
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the load balancer is listening on the required ports. The following example references ports
80
,443
,6443
, and22623
.For HAProxy instances running on Red Hat Enterprise Linux (RHEL) 6, verify port status by using the
netstat
command:ssh <user_name>@<load_balancer> netstat -nltupe | grep -E ':80|:443|:6443|:22623'
$ ssh <user_name>@<load_balancer> netstat -nltupe | grep -E ':80|:443|:6443|:22623'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For HAProxy instances running on Red Hat Enterprise Linux (RHEL) 7 or 8, verify port status by using the
ss
command:ssh <user_name>@<load_balancer> ss -nltupe | grep -E ':80|:443|:6443|:22623'
$ ssh <user_name>@<load_balancer> ss -nltupe | grep -E ':80|:443|:6443|:22623'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteRed Hat recommends the
ss
command instead ofnetstat
in Red Hat Enterprise Linux (RHEL) 7 or later.ss
is provided by the iproute package. For more information on thess
command, see the Red Hat Enterprise Linux (RHEL) 7 Performance Tuning Guide.
Check that the wildcard DNS record resolves to the load balancer:
dig <wildcard_fqdn> @<dns_server>
$ dig <wildcard_fqdn> @<dns_server>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1.4. Specifying OpenShift Container Platform installer log levels Copia collegamentoCollegamento copiato negli appunti!
By default, the OpenShift Container Platform installer log level is set to info
. If more detailed logging is required when diagnosing a failed OpenShift Container Platform installation, you can increase the openshift-install
log level to debug
when starting the installation again.
Prerequisites
- You have access to the installation host.
Procedure
Set the installation log level to
debug
when initiating the installation:./openshift-install --dir=<installation_directory> wait-for bootstrap-complete --log-level=debug
$ ./openshift-install --dir=<installation_directory> wait-for bootstrap-complete --log-level=debug
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Possible log levels include
info
,warn
,error,
anddebug
.
5.1.5. Troubleshooting openshift-install command issues Copia collegamentoCollegamento copiato negli appunti!
If you experience issues running the openshift-install
command, check the following:
The installation has been initiated within 24 hours of Ignition configuration file creation. The Ignition files are created when the following command is run:
./openshift-install create ignition-configs --dir=./install_dir
$ ./openshift-install create ignition-configs --dir=./install_dir
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The
install-config.yaml
file is in the same directory as the installer. If an alternative installation path is declared by using the./openshift-install --dir
option, verify that theinstall-config.yaml
file exists within that directory.
5.1.6. Monitoring installation progress Copia collegamentoCollegamento copiato negli appunti!
You can monitor high-level installation, bootstrap, and control plane logs as an OpenShift Container Platform installation progresses. This provides greater visibility into how an installation progresses and helps identify the stage at which an installation failure occurs.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
). - You have SSH access to your hosts.
You have the fully qualified domain names of the bootstrap and master nodes.
NoteThe initial
kubeadmin
password can be found in<install_directory>/auth/kubeadmin-password
on the installation host.
Procedure
Watch the installation log as the installation progresses:
tail -f ~/<installation_directory>/.openshift_install.log
$ tail -f ~/<installation_directory>/.openshift_install.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Monitor the
bootkube.service
journald unit log on the bootstrap node, after it has booted. This provides visibility into the bootstrapping of the first control plane. Replace<bootstrap_fqdn>
with the bootstrap node’s fully qualified domain name:ssh core@<bootstrap_fqdn> journalctl -b -f -u bootkube.service
$ ssh core@<bootstrap_fqdn> journalctl -b -f -u bootkube.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
bootkube.service
log on the bootstrap node outputs etcdconnection refused
errors, indicating that the bootstrap server is unable to connect to etcd on master nodes. After etcd has started on each master node and the nodes have joined the cluster, the errors should stop.Monitor
kubelet.service
journald unit logs on master nodes, after they have booted. This provides visibility into master node agent activity.Monitor the logs using
oc
:oc adm node-logs --role=master -u kubelet
$ oc adm node-logs --role=master -u kubelet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead. Replace
<master-node>.<cluster_name>.<base_domain>
with appropriate values:ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service
$ ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Monitor
crio.service
journald unit logs on master nodes, after they have booted. This provides visibility into master node CRI-O container runtime activity.Monitor the logs using
oc
:oc adm node-logs --role=master -u crio
$ oc adm node-logs --role=master -u crio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead. Replace
<master-node>.<cluster_name>.<base_domain>
with appropriate values:ssh core@master-N.cluster_name.sub_domain.domain journalctl -b -f -u crio.service
$ ssh core@master-N.cluster_name.sub_domain.domain journalctl -b -f -u crio.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1.7. Gathering bootstrap node diagnostic data Copia collegamentoCollegamento copiato negli appunti!
When experiencing bootstrap-related issues, you can gather bootkube.service
journald
unit logs and container logs from the bootstrap node.
Prerequisites
- You have SSH access to your bootstrap node.
- You have the fully qualified domain name of the bootstrap node.
- If you are hosting Ignition configuration files by using an HTTP server, you must have the HTTP server’s fully qualified domain name and the port number. You must also have SSH access to the HTTP host.
Procedure
- If you have access to the bootstrap node’s console, monitor the console until the node reaches the login prompt.
Verify the Ignition file configuration.
If you are hosting Ignition configuration files by using an HTTP server.
Verify the bootstrap node Ignition file URL. Replace
<http_server_fqdn>
with HTTP server’s fully qualified domain name:curl -I http://<http_server_fqdn>:<port>/bootstrap.ign
$ curl -I http://<http_server_fqdn>:<port>/bootstrap.ign
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
-I
option returns the header only. If the Ignition file is available on the specified URL, the command returns200 OK
status. If it is not available, the command returns404 file not found
.
To verify that the Ignition file was received by the bootstrap node, query the HTTP server logs on the serving host. For example, if you are using an Apache web server to serve Ignition files, enter the following command:
grep -is 'bootstrap.ign' /var/log/httpd/access_log
$ grep -is 'bootstrap.ign' /var/log/httpd/access_log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the bootstrap Ignition file is received, the associated
HTTP GET
log message will include a200 OK
success status, indicating that the request succeeded.- If the Ignition file was not received, check that the Ignition files exist and that they have the appropriate file and web server permissions on the serving host directly.
If you are using a cloud provider mechanism to inject Ignition configuration files into hosts as part of their initial deployment.
- Review the bootstrap node’s console to determine if the mechanism is injecting the bootstrap node Ignition file correctly.
- Verify the availability of the bootstrap node’s assigned storage device.
- Verify that the bootstrap node has been assigned an IP address from the DHCP server.
Collect
bootkube.service
journald unit logs from the bootstrap node. Replace<bootstrap_fqdn>
with the bootstrap node’s fully qualified domain name:ssh core@<bootstrap_fqdn> journalctl -b -f -u bootkube.service
$ ssh core@<bootstrap_fqdn> journalctl -b -f -u bootkube.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
bootkube.service
log on the bootstrap node outputs etcdconnection refused
errors, indicating that the bootstrap server is unable to connect to etcd on master nodes. After etcd has started on each master node and the nodes have joined the cluster, the errors should stop.Collect logs from the bootstrap node containers.
Collect the logs using
podman
on the bootstrap node. Replace<bootstrap_fqdn>
with the bootstrap node’s fully qualified domain name:ssh core@<bootstrap_fqdn> 'for pod in $(sudo podman ps -a -q); do sudo podman logs $pod; done'
$ ssh core@<bootstrap_fqdn> 'for pod in $(sudo podman ps -a -q); do sudo podman logs $pod; done'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If the bootstrap process fails, verify the following.
-
You can resolve
api.<cluster_name>.<base_domain>
from the installation host. - The load balancer proxies port 6443 connections to bootstrap and master nodes. Ensure that the proxy configuration meets OpenShift Container Platform installation requirements.
-
You can resolve
5.1.8. Investigating master node installation issues Copia collegamentoCollegamento copiato negli appunti!
If you experience master node installation issues, determine the master node, OpenShift Container Platform software defined network (SDN), and network Operator status. Collect kubelet.service
, crio.service
journald unit logs, and master node container logs for visibility into master node agent, CRI-O container runtime, and pod activity.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
). - You have SSH access to your hosts.
- You have the fully qualified domain names of the bootstrap and master nodes.
If you are hosting Ignition configuration files by using an HTTP server, you must have the HTTP server’s fully qualified domain name and the port number. You must also have SSH access to the HTTP host.
NoteThe initial
kubeadmin
password can be found in<install_directory>/auth/kubeadmin-password
on the installation host.
Procedure
- If you have access to the master node’s console, monitor the console until the node reaches the login prompt. During the installation, Ignition log messages are output to the console.
Verify Ignition file configuration.
If you are hosting Ignition configuration files by using an HTTP server.
Verify the master node Ignition file URL. Replace
<http_server_fqdn>
with HTTP server’s fully qualified domain name:curl -I http://<http_server_fqdn>:<port>/master.ign
$ curl -I http://<http_server_fqdn>:<port>/master.ign
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
-I
option returns the header only. If the Ignition file is available on the specified URL, the command returns200 OK
status. If it is not available, the command returns404 file not found
.
To verify that the Ignition file was received by the master node, query the HTTP server logs on the serving host. For example, if you are using an Apache web server to serve Ignition files:
grep -is 'master.ign' /var/log/httpd/access_log
$ grep -is 'master.ign' /var/log/httpd/access_log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the master Ignition file is received, the associated
HTTP GET
log message will include a200 OK
success status, indicating that the request succeeded.- If the Ignition file was not received, check that it exists on the serving host directly. Ensure that the appropriate file and web server permissions are in place.
If you are using a cloud provider mechanism to inject Ignition configuration files into hosts as part of their initial deployment.
- Review the master node’s console to determine if the mechanism is injecting the master node Ignition file correctly.
- Check the availability of the master node’s assigned storage device.
- Verify that the master node has been assigned an IP address from the DHCP server.
Determine master node status.
Query master node status:
oc get nodes
$ oc get nodes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If one of the master nodes does not reach a
Ready
status, retrieve a detailed node description:oc describe node <master_node>
$ oc describe node <master_node>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIt is not possible to run
oc
commands if an installation issue prevents the OpenShift Container Platform API from running or if the kubelet is not running yet on each node:
Determine OpenShift Container Platform SDN status.
Review
sdn-controller
,sdn
, andovs
daemon set status, in theopenshift-sdn
namespace:oc get daemonsets -n openshift-sdn
$ oc get daemonsets -n openshift-sdn
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If those resources are listed as
Not found
, review pods in theopenshift-sdn
namespace:oc get pods -n openshift-sdn
$ oc get pods -n openshift-sdn
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review logs relating to failed OpenShift Container Platform SDN pods in the
openshift-sdn
namespace:oc logs <sdn_pod> -n openshift-sdn
$ oc logs <sdn_pod> -n openshift-sdn
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Determine cluster network configuration status.
Review whether the cluster’s network configuration exists:
oc get network.config.openshift.io cluster -o yaml
$ oc get network.config.openshift.io cluster -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the installer failed to create the network configuration, generate the Kubernetes manifests again and review message output:
./openshift-install create manifests
$ ./openshift-install create manifests
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review the pod status in the
openshift-network-operator
namespace to determine whether the Cluster Network Operator (CNO) is running:oc get pods -n openshift-network-operator
$ oc get pods -n openshift-network-operator
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Gather network Operator pod logs from the
openshift-network-operator
namespace:oc logs pod/<network_operator_pod_name> -n openshift-network-operator
$ oc logs pod/<network_operator_pod_name> -n openshift-network-operator
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Monitor
kubelet.service
journald unit logs on master nodes, after they have booted. This provides visibility into master node agent activity.Retrieve the logs using
oc
:oc adm node-logs --role=master -u kubelet
$ oc adm node-logs --role=master -u kubelet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead. Replace
<master-node>.<cluster_name>.<base_domain>
with appropriate values:ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service
$ ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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 gather
and otheroc
commands is sufficient instead. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
.
Retrieve
crio.service
journald unit logs on master nodes, after they have booted. This provides visibility into master node CRI-O container runtime activity.Retrieve the logs using
oc
:oc adm node-logs --role=master -u crio
$ oc adm node-logs --role=master -u crio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead:
ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u crio.service
$ ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u crio.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Collect logs from specific subdirectories under
/var/log/
on master 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-apiserver
Copy 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.log
contents 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.log
Copy 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.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Review master node container logs using SSH.
List the containers:
ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl ps -a
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl ps -a
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve a container’s logs using
crictl
:ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl logs -f <container_id>
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl logs -f <container_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you experience master node configuration issues, verify that the MCO, MCO endpoint, and DNS record are functioning. The Machine Config Operator (MCO) manages operating system configuration during the installation procedure. Also verify system clock accuracy and certificate validity.
Test whether the MCO endpoint is available. Replace
<cluster_name>
with appropriate values:curl https://api-int.<cluster_name>:22623/config/master
$ curl https://api-int.<cluster_name>:22623/config/master
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If the endpoint is unresponsive, verify load balancer configuration. Ensure that the endpoint is configured to run on port 22623.
Verify that the MCO endpoint’s DNS record is configured and resolves to the load balancer.
Run a DNS lookup for the defined MCO endpoint name:
dig api-int.<cluster_name> @<dns_server>
$ dig api-int.<cluster_name> @<dns_server>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run a reverse lookup to the assigned MCO IP address on the load balancer:
dig -x <load_balancer_mco_ip_address> @<dns_server>
$ dig -x <load_balancer_mco_ip_address> @<dns_server>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verify that the MCO is functioning from the bootstrap node directly. Replace
<bootstrap_fqdn>
with the bootstrap node’s fully qualified domain name:ssh core@<bootstrap_fqdn> curl https://api-int.<cluster_name>:22623/config/master
$ ssh core@<bootstrap_fqdn> curl https://api-int.<cluster_name>:22623/config/master
Copy to Clipboard Copied! Toggle word wrap Toggle overflow System clock time must be synchronized between bootstrap, master, and worker nodes. Check each node’s system clock reference time and time synchronization statistics:
ssh core@<node>.<cluster_name>.<base_domain> chronyc tracking
$ ssh core@<node>.<cluster_name>.<base_domain> chronyc tracking
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review certificate validity:
openssl s_client -connect api-int.<cluster_name>:22623 | openssl x509 -noout -text
$ openssl s_client -connect api-int.<cluster_name>:22623 | openssl x509 -noout -text
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1.9. Investigating etcd installation issues Copia collegamentoCollegamento copiato negli appunti!
If you experience etcd issues during installation, you can check etcd pod status and collect etcd pod logs. You can also verify etcd DNS records and check DNS availability on master nodes.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
). - You have SSH access to your hosts.
- You have the fully qualified domain names of the master nodes.
Procedure
Check the status of etcd pods.
Review the status of pods in the
openshift-etcd
namespace:oc get pods -n openshift-etcd
$ oc get pods -n openshift-etcd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review the status of pods in the
openshift-etcd-operator
namespace:oc get pods -n openshift-etcd-operator
$ oc get pods -n openshift-etcd-operator
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If any of the pods listed by the previous commands are not showing a
Running
or aCompleted
status, gather diagnostic information for the pod.Review events for the pod:
oc describe pod/<pod_name> -n <namespace>
$ oc describe pod/<pod_name> -n <namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Inspect the pod’s logs:
oc logs pod/<pod_name> -n <namespace>
$ oc logs pod/<pod_name> -n <namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the pod has more than one container, the preceding command will create an error, and the container names will be provided in the error message. Inspect logs for each container:
oc logs pod/<pod_name> -c <container_name> -n <namespace>
$ oc logs pod/<pod_name> -c <container_name> -n <namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If the API is not functional, review etcd pod and container logs on each master node by using SSH instead. Replace
<master-node>.<cluster_name>.<base_domain>
with appropriate values.List etcd pods on each master node:
ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl pods --name=etcd-
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl pods --name=etcd-
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For any pods not showing
Ready
status, inspect pod status in detail. Replace<pod_id>
with the pod’s ID listed in the output of the preceding command:ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl inspectp <pod_id>
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl inspectp <pod_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List containers related to a pod:
ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl ps | grep '<pod_id>'
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl ps | grep '<pod_id>'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For any containers not showing
Ready
status, inspect container status in detail. Replace<container_id>
with container IDs listed in the output of the preceding command:ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl inspect <container_id>
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl inspect <container_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review the logs for any containers not showing a
Ready
status. Replace<container_id>
with the container IDs listed in the output of the preceding command:ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl logs -f <container_id>
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl logs -f <container_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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 gather
and otheroc
commands is sufficient instead. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
.
- Validate primary and secondary DNS server connectivity from master nodes.
5.1.10. Investigating master node kubelet and API server issues Copia collegamentoCollegamento copiato negli appunti!
To investigate master node kubelet and API server issues during installation, check DNS, DHCP, and load balancer functionality. Also, verify that certificates have not expired.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
). - You have SSH access to your hosts.
- You have the fully qualified domain names of the master nodes.
Procedure
-
Verify that the API server’s DNS record directs the kubelet on master nodes to
https://api-int.<cluster_name>.<base_domain>:6443
. Ensure that the record references the load balancer. - Ensure that the load balancer’s port 6443 definition references each master node.
- Check that unique master node host names have been provided by DHCP.
Inspect the
kubelet.service
journald unit logs on each master node.Retrieve the logs using
oc
:oc adm node-logs --role=master -u kubelet
$ oc adm node-logs --role=master -u kubelet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead. Replace
<master-node>.<cluster_name>.<base_domain>
with appropriate values:ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service
$ ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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 gather
and otheroc
commands is sufficient instead. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
.
Check for certificate expiration messages in the master node kubelet logs.
Retrieve the log using
oc
:oc adm node-logs --role=master -u kubelet | grep -is 'x509: certificate has expired'
$ oc adm node-logs --role=master -u kubelet | grep -is 'x509: certificate has expired'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead. Replace
<master-node>.<cluster_name>.<base_domain>
with appropriate values:ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service | grep -is 'x509: certificate has expired'
$ ssh core@<master-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service | grep -is 'x509: certificate has expired'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1.11. Investigating worker node installation issues Copia collegamentoCollegamento copiato negli appunti!
If you experience worker node installation issues, you can review the worker node status. Collect kubelet.service
, crio.service
journald unit logs and the worker node container logs for visibility into the worker node agent, CRI-O container runtime and pod activity. Additionally, you can check the Ignition file and Machine API Operator functionality. If worker node post-installation configuration fails, check Machine Config Operator (MCO) and DNS functionality. You can also verify system clock synchronization between the bootstrap, master, and worker nodes, and validate certificates.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
). - You have SSH access to your hosts.
- You have the fully qualified domain names of the bootstrap and worker nodes.
If you are hosting Ignition configuration files by using an HTTP server, you must have the HTTP server’s fully qualified domain name and the port number. You must also have SSH access to the HTTP host.
NoteThe initial
kubeadmin
password can be found in<install_directory>/auth/kubeadmin-password
on the installation host.
Procedure
- If you have access to the worker node’s console, monitor the console until the node reaches the login prompt. During the installation, Ignition log messages are output to the console.
Verify Ignition file configuration.
If you are hosting Ignition configuration files by using an HTTP server.
Verify the worker node Ignition file URL. Replace
<http_server_fqdn>
with HTTP server’s fully qualified domain name:curl -I http://<http_server_fqdn>:<port>/worker.ign
$ curl -I http://<http_server_fqdn>:<port>/worker.ign
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
-I
option returns the header only. If the Ignition file is available on the specified URL, the command returns200 OK
status. If it is not available, the command returns404 file not found
.
To verify that the Ignition file was received by the worker node, query the HTTP server logs on the HTTP host. For example, if you are using an Apache web server to serve Ignition files:
grep -is 'worker.ign' /var/log/httpd/access_log
$ grep -is 'worker.ign' /var/log/httpd/access_log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the worker Ignition file is received, the associated
HTTP GET
log message will include a200 OK
success status, indicating that the request succeeded.- If the Ignition file was not received, check that it exists on the serving host directly. Ensure that the appropriate file and web server permissions are in place.
If you are using a cloud provider mechanism to inject Ignition configuration files into hosts as part of their initial deployment.
- Review the worker node’s console to determine if the mechanism is injecting the worker node Ignition file correctly.
- Check the availability of the worker node’s assigned storage device.
- Verify that the worker node has been assigned an IP address from the DHCP server.
Determine worker node status.
Query node status:
oc get nodes
$ oc get nodes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve a detailed node description for any worker nodes not showing a
Ready
status:oc describe node <worker_node>
$ oc describe node <worker_node>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIt is not possible to run
oc
commands if an installation issue prevents the OpenShift Container Platform API from running or if the kubelet is not running yet on each node.
Unlike master nodes, worker nodes are deployed and scaled using the Machine API Operator. Check the status of the Machine API Operator.
Review Machine API Operator pod status:
oc get pods -n openshift-machine-api
$ oc get pods -n openshift-machine-api
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the Machine API Operator pod does not have a
Ready
status, detail the pod’s events:oc describe pod/<machine_api_operator_pod_name> -n openshift-machine-api
$ oc describe pod/<machine_api_operator_pod_name> -n openshift-machine-api
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Inspect
machine-api-operator
container logs. The container runs within themachine-api-operator
pod:oc logs pod/<machine_api_operator_pod_name> -n openshift-machine-api -c machine-api-operator
$ oc logs pod/<machine_api_operator_pod_name> -n openshift-machine-api -c machine-api-operator
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Also inspect
kube-rbac-proxy
container logs. The container also runs within themachine-api-operator
pod:oc logs pod/<machine_api_operator_pod_name> -n openshift-machine-api -c kube-rbac-proxy
$ oc logs pod/<machine_api_operator_pod_name> -n openshift-machine-api -c kube-rbac-proxy
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Monitor
kubelet.service
journald unit logs on worker nodes, after they have booted. This provides visibility into worker node agent activity.Retrieve the logs using
oc
:oc adm node-logs --role=worker -u kubelet
$ oc adm node-logs --role=worker -u kubelet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead. Replace
<worker-node>.<cluster_name>.<base_domain>
with appropriate values:ssh core@<worker-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service
$ ssh core@<worker-node>.<cluster_name>.<base_domain> journalctl -b -f -u kubelet.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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 gather
and otheroc
commands is sufficient instead. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
.
Retrieve
crio.service
journald unit logs on worker nodes, after they have booted. This provides visibility into worker node CRI-O container runtime activity.Retrieve the logs using
oc
:oc adm node-logs --role=worker -u crio
$ oc adm node-logs --role=worker -u crio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead:
ssh core@<worker-node>.<cluster_name>.<base_domain> journalctl -b -f -u crio.service
$ ssh core@<worker-node>.<cluster_name>.<base_domain> journalctl -b -f -u crio.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Collect logs from specific subdirectories under
/var/log/
on worker nodes.Retrieve a list of logs contained within a
/var/log/
subdirectory. The following example lists files in/var/log/sssd/
on all worker nodes:oc adm node-logs --role=worker --path=sssd
$ oc adm node-logs --role=worker --path=sssd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Inspect a specific log within a
/var/log/
subdirectory. The following example outputs/var/log/sssd/audit.log
contents from all worker nodes:oc adm node-logs --role=worker --path=sssd/sssd.log
$ oc adm node-logs --role=worker --path=sssd/sssd.log
Copy 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/sssd/sssd.log
:ssh core@<worker-node>.<cluster_name>.<base_domain> sudo tail -f /var/log/sssd/sssd.log
$ ssh core@<worker-node>.<cluster_name>.<base_domain> sudo tail -f /var/log/sssd/sssd.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Review worker node container logs using SSH.
List the containers:
ssh core@<worker-node>.<cluster_name>.<base_domain> sudo crictl ps -a
$ ssh core@<worker-node>.<cluster_name>.<base_domain> sudo crictl ps -a
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve a container’s logs using
crictl
:ssh core@<worker-node>.<cluster_name>.<base_domain> sudo crictl logs -f <container_id>
$ ssh core@<worker-node>.<cluster_name>.<base_domain> sudo crictl logs -f <container_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you experience worker node configuration issues, verify that the MCO, MCO endpoint, and DNS record are functioning. The Machine Config Operator (MCO) manages operating system configuration during the installation procedure. Also verify system clock accuracy and certificate validity.
Test whether the MCO endpoint is available. Replace
<cluster_name>
with appropriate values:curl https://api-int.<cluster_name>:22623/config/worker
$ curl https://api-int.<cluster_name>:22623/config/worker
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If the endpoint is unresponsive, verify load balancer configuration. Ensure that the endpoint is configured to run on port 22623.
Verify that the MCO endpoint’s DNS record is configured and resolves to the load balancer.
Run a DNS lookup for the defined MCO endpoint name:
dig api-int.<cluster_name> @<dns_server>
$ dig api-int.<cluster_name> @<dns_server>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run a reverse lookup to the assigned MCO IP address on the load balancer:
dig -x <load_balancer_mco_ip_address> @<dns_server>
$ dig -x <load_balancer_mco_ip_address> @<dns_server>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verify that the MCO is functioning from the bootstrap node directly. Replace
<bootstrap_fqdn>
with the bootstrap node’s fully qualified domain name:ssh core@<bootstrap_fqdn> curl https://api-int.<cluster_name>:22623/config/worker
$ ssh core@<bootstrap_fqdn> curl https://api-int.<cluster_name>:22623/config/worker
Copy to Clipboard Copied! Toggle word wrap Toggle overflow System clock time must be synchronized between bootstrap, master, and worker nodes. Check each node’s system clock reference time and time synchronization statistics:
ssh core@<node>.<cluster_name>.<base_domain> chronyc tracking
$ ssh core@<node>.<cluster_name>.<base_domain> chronyc tracking
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review certificate validity:
openssl s_client -connect api-int.<cluster_name>:22623 | openssl x509 -noout -text
$ openssl s_client -connect api-int.<cluster_name>:22623 | openssl x509 -noout -text
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1.12. Querying Operator status after installation Copia collegamentoCollegamento copiato negli appunti!
You can check Operator status at the end of an installation. Retrieve diagnostic data for Operators that do not become available. Review logs for any Operator pods that are listed as Pending
or have an error status. Validate base images used by problematic pods.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
).
Procedure
Check that cluster Operators are all available at the end of an installation.
oc get clusteroperators
$ oc get clusteroperators
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If any Operators fail to become available, view Operator events:
oc describe clusteroperator <operator_name>
$ oc describe clusteroperator <operator_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review Operator pod status within the Operator’s namespace:
oc get pods -n <operator_namespace>
$ oc get pods -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Obtain a detailed description for pods that do not have
Running
status:oc describe pod/<operator_pod_name> -n <operator_namespace>
$ oc describe pod/<operator_pod_name> -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Inspect pod logs:
oc logs pod/<operator_pod_name> -n <operator_namespace>
$ oc logs pod/<operator_pod_name> -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow When experiencing pod base image related issues, review base image status.
Obtain details of the base image used by a problematic pod:
oc get pod -o "jsonpath={range .status.containerStatuses[*]}{.name}{'\t'}{.state}{'\t'}{.image}{'\n'}{end}" <operator_pod_name> -n <operator_namespace>
$ oc get pod -o "jsonpath={range .status.containerStatuses[*]}{.name}{'\t'}{.state}{'\t'}{.image}{'\n'}{end}" <operator_pod_name> -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List base image release information:
oc adm release info <image_path>:<tag> --commits
$ oc adm release info <image_path>:<tag> --commits
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.1.13. Gathering logs from a failed installation Copia collegamentoCollegamento copiato negli appunti!
If you gave an SSH key to your installation program, you can gather data about your failed installation.
You use a different command to gather logs about an unsuccessful installation than to gather logs from a running cluster. If you must gather logs from a running cluster, use the oc adm must-gather
command.
Prerequisites
- Your OpenShift Container Platform installation failed before the bootstrap process finished. The bootstrap node is running and accessible through SSH.
-
The
ssh-agent
process is active on your computer, and you provided the same SSH key to both thessh-agent
process and the installation program. - If you tried to install a cluster on infrastructure that you provisioned, you must have the fully qualified domain names of the bootstrap and master nodes.
Procedure
Generate the commands that are required to obtain the installation logs from the bootstrap and control plane machines:
If you used installer-provisioned infrastructure, run the following command:
./openshift-install gather bootstrap --dir=<installation_directory>
$ ./openshift-install gather bootstrap --dir=<installation_directory>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
installation_directory
is the directory you specified when you ran./openshift-install create cluster
. This directory contains the OpenShift Container Platform definition files that the installation program creates.
For installer-provisioned infrastructure, the installation program stores information about the cluster, so you do not specify the host names or IP addresses.
If you used infrastructure that you provisioned yourself, run the following command:
./openshift-install gather bootstrap --dir=<installation_directory> \ --bootstrap <bootstrap_address> \ --master <master_1_address> \ --master <master_2_address> \ --master <master_3_address>"
$ ./openshift-install gather bootstrap --dir=<installation_directory> \
1 --bootstrap <bootstrap_address> \
2 --master <master_1_address> \
3 --master <master_2_address> \
4 --master <master_3_address>"
5 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For
installation_directory
, specify the same directory you specified when you ran./openshift-install create cluster
. This directory contains the OpenShift Container Platform definition files that the installation program creates. - 2
<bootstrap_address>
is the fully qualified domain name or IP address of the cluster’s bootstrap machine.- 3 4 5
- For each control plane, or master, machine in your cluster, replace
<master_*_address>
with its fully qualified domain name or IP address.
NoteA default cluster contains three control plane machines. List all of your control plane machines as shown, no matter how many your cluster uses.
Example output
INFO Pulling debug logs from the bootstrap machine INFO Bootstrap gather logs captured here "<installation_directory>/log-bundle-<timestamp>.tar.gz"
INFO Pulling debug logs from the bootstrap machine INFO Bootstrap gather logs captured here "<installation_directory>/log-bundle-<timestamp>.tar.gz"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you open a Red Hat support case about your installation failure, include the compressed logs in the case.
5.1.14. Additional resources Copia collegamentoCollegamento copiato negli appunti!
- See Installation process for more details on OpenShift Container Platform installation types and process.
5.2. Verifying node health Copia collegamentoCollegamento copiato negli appunti!
5.2.1. Reviewing node status, resource usage, and configuration Copia collegamentoCollegamento copiato negli appunti!
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-admin
role. -
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 nodes
Copy 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 nodes
Copy 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-node
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2.2. Querying the kubelet’s status on a node Copia collegamentoCollegamento copiato negli appunti!
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-admin
role. - 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
kubelet
systemd service within a debug pod.Start a debug pod for a node:
oc debug node/my-node
$ oc debug node/my-node
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set
/host
as the root directory within the debug shell. The debug pod mounts the host’s root file system in/host
within the pod. By changing the root directory to/host
, you can run binaries contained in the host’s executable paths:chroot /host
# chroot /host
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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
kubelet
is not properly functioning on the target node,oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
instead.Check whether the
kubelet
systemd service is active on the node:systemctl is-active kubelet
# systemctl is-active kubelet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Output a more detailed
kubelet.service
status summary:systemctl status kubelet
# systemctl status kubelet
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.2.3. Querying cluster node journal logs Copia collegamentoCollegamento copiato negli appunti!
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-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
). - You have SSH access to your hosts.
Procedure
Query
kubelet
journald
unit 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 kubelet
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace
kubelet
as 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-apiserver
Copy 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.log
contents 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.log
Copy 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.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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 gather
and otheroc
commands is sufficient instead. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
.
5.3. Troubleshooting CRI-O container runtime issues Copia collegamentoCollegamento copiato negli appunti!
5.3.1. About CRI-O container runtime engine Copia collegamentoCollegamento copiato negli appunti!
CRI-O is a Kubernetes-native container runtime implementation that integrates closely with the operating system to deliver an efficient and optimized Kubernetes experience. CRI-O provides facilities for running, stopping, and restarting containers.
The CRI-O container runtime engine is managed using a systemd service on each OpenShift Container Platform cluster node. When container runtime issues occur, verify the status of the crio
systemd service on each node. Gather CRI-O journald unit logs from nodes that manifest container runtime issues.
5.3.2. Verifying CRI-O runtime engine status Copia collegamentoCollegamento copiato negli appunti!
You can verify CRI-O container runtime engine status on each cluster node.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
).
Procedure
Review CRI-O status by querying the
crio
systemd service on a node, within a debug pod.Start a debug pod for a node:
oc debug node/my-node
$ oc debug node/my-node
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set
/host
as the root directory within the debug shell. The debug pod mounts the host’s root file system in/host
within the pod. By changing the root directory to/host
, you can run binaries contained in the host’s executable paths:chroot /host
# chroot /host
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,
oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
instead.Check whether the
crio
systemd service is active on the node:systemctl is-active crio
# systemctl is-active crio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Output a more detailed
kubelet.service
status summary:systemctl status crio
# systemctl status crio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.3.3. Gathering CRI-O journald unit logs Copia collegamentoCollegamento copiato negli appunti!
If you experience CRI-O issues, you can obtain CRI-O journald unit logs from a node.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
). - You have the fully qualified domain names of the control plane, or master machines.
Procedure
Gather CRI-O journald unit logs. The following example collects logs from all master nodes within the cluster:
oc adm node-logs --role=master -u crio
$ oc adm node-logs --role=master -u crio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Gather CRI-O journald unit logs from a specific node:
oc adm node-logs <node_name> -u crio
$ oc adm node-logs <node_name> -u crio
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review the logs using SSH instead. Replace
<node>.<cluster_name>.<base_domain>
with appropriate values:ssh core@<node>.<cluster_name>.<base_domain> journalctl -b -f -u crio.service
$ ssh core@<node>.<cluster_name>.<base_domain> journalctl -b -f -u crio.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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 gather
and otheroc
commands is sufficient instead. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
.
5.4. Troubleshooting Operator issues Copia collegamentoCollegamento copiato negli appunti!
Operators are a method of packaging, deploying, and managing an OpenShift Container Platform application. They act like an extension of the software vendor’s engineering team, watching over an OpenShift Container Platform environment and using its current state to make decisions in real time. Operators are designed to handle upgrades seamlessly, react to failures automatically, and not take shortcuts, such as skipping a software backup process to save time.
OpenShift Container Platform 4.5 includes a default set of Operators that are required for proper functioning of the cluster. These default Operators are managed by the Cluster Version Operator (CVO).
As a cluster administrator, you can install application Operators from the OperatorHub using the OpenShift Container Platform web console or the CLI. You can then subscribe the Operator to one or more namespaces to make it available for developers on your cluster. Application Operators are managed by Operator Lifecycle Manager (OLM).
If you experience Operator issues, verify Operator subscription status. Check Operator pod health across the cluster and gather Operator logs for diagnosis.
5.4.1. Operator subscription condition types Copia collegamentoCollegamento copiato negli appunti!
Subscriptions can report the following condition types:
Condition | Description |
---|---|
| Some or all of the catalog sources to be used in resolution are unhealthy. |
| An install plan for a subscription is missing. |
| An install plan for a subscription is pending installation. |
| An install plan for a subscription has failed. |
Default OpenShift Container Platform cluster Operators are managed by the Cluster Version Operator (CVO) and they do not have a Subscription
object. Application Operators are managed by Operator Lifecycle Manager (OLM) and they have a Subscription
object.
5.4.2. Viewing Operator subscription status using the CLI Copia collegamentoCollegamento copiato negli appunti!
You can view Operator subscription status using the CLI.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
).
Procedure
List Operator subscriptions:
oc get subs -n <operator_namespace>
$ oc get subs -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
oc describe
command to inspect aSubscription
resource:oc describe sub <subscription_name> -n <operator_namespace>
$ oc describe sub <subscription_name> -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the command output, find the
Conditions
section for the status of Operator subscription condition types. In the following example, theCatalogSourcesUnhealthy
condition type has a status offalse
because all available catalog sources are healthy:Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Default OpenShift Container Platform cluster Operators are managed by the Cluster Version Operator (CVO) and they do not have a Subscription
object. Application Operators are managed by Operator Lifecycle Manager (OLM) and they have a Subscription
object.
5.4.3. Querying Operator pod status Copia collegamentoCollegamento copiato negli appunti!
You can list Operator pods within a cluster and their status. You can also collect a detailed Operator pod summary.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
).
Procedure
List Operators running in the cluster. The output includes Operator version, availability, and up-time information:
oc get clusteroperators
$ oc get clusteroperators
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List Operator pods running in the Operator’s namespace, plus pod status, restarts, and age:
oc get pod -n <operator_namespace>
$ oc get pod -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Output a detailed Operator pod summary:
oc describe pod <operator_pod_name> -n <operator_namespace>
$ oc describe pod <operator_pod_name> -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If an Operator issue is node-specific, query Operator container status on that node.
Start a debug pod for the node:
oc debug node/my-node
$ oc debug node/my-node
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set
/host
as the root directory within the debug shell. The debug pod mounts the host’s root file system in/host
within the pod. By changing the root directory to/host
, you can run binaries contained in the host’s executable paths:chroot /host
# chroot /host
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,
oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
instead.List details about the node’s containers, including state and associated pod IDs:
crictl ps
# crictl ps
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List information about a specific Operator container on the node. The following example lists information about the
network-operator
container:crictl ps --name network-operator
# crictl ps --name network-operator
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Exit from the debug shell.
5.4.4. Gathering Operator logs Copia collegamentoCollegamento copiato negli appunti!
If you experience Operator issues, you can gather detailed diagnostic information from Operator pod logs.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
). - You have the fully qualified domain names of the control plane, or master machines.
Procedure
List the Operator pods that are running in the Operator’s namespace, plus the pod status, restarts, and age:
oc get pods -n <operator_namespace>
$ oc get pods -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review logs for an Operator pod:
oc logs pod/<pod_name> -n <operator_namespace>
$ oc logs pod/<pod_name> -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If an Operator pod has multiple containers, the preceding command will produce an error that includes the name of each container. Query logs from an individual container:
oc logs pod/<operator_pod_name> -c <container_name> -n <operator_namespace>
$ oc logs pod/<operator_pod_name> -c <container_name> -n <operator_namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the API is not functional, review Operator pod and container logs on each master node by using SSH instead. Replace
<master-node>.<cluster_name>.<base_domain>
with appropriate values.List pods on each master node:
ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl pods
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl pods
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For any Operator pods not showing a
Ready
status, inspect the pod’s status in detail. Replace<operator_pod_id>
with the Operator pod’s ID listed in the output of the preceding command:ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl inspectp <operator_pod_id>
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl inspectp <operator_pod_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List containers related to an Operator pod:
ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl ps --pod=<operator_pod_id>
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl ps --pod=<operator_pod_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For any Operator container not showing a
Ready
status, inspect the container’s status in detail. Replace<container_id>
with a container ID listed in the output of the preceding command:ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl inspect <container_id>
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl inspect <container_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review the logs for any Operator containers not showing a
Ready
status. Replace<container_id>
with a container ID listed in the output of the preceding command:ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl logs -f <container_id>
$ ssh core@<master-node>.<cluster_name>.<base_domain> sudo crictl logs -f <container_id>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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 gather
and otheroc
commands is sufficient instead. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
.
5.4.5. Disabling the Machine Config Operator from automatically rebooting Copia collegamentoCollegamento copiato negli appunti!
When configuration changes are made by the Machine Config Operator, Red Hat Enterprise Linux CoreOS (RHCOS) must reboot for the changes to take effect. Whether the configuration change is automatic, such as when a kube-apiserver-to-kubelet-signer
CA is rotated, or manual, such as when a registry or SSH key is updated, an RHCOS node reboots automatically unless it is paused.
To avoid unwanted disruptions, you can modify the machine config pool (MCP) to prevent automatic rebooting after the Operator makes changes to the machine config.
Pausing a machine config pool stops all system reboot processes and all configuration changes from being applied.
5.4.5.1. Disabling the Machine Config Operator from automatically rebooting by using the console Copia collegamentoCollegamento copiato negli appunti!
To avoid unwanted disruptions from changes made by the Machine Config Operator (MCO), you can use the OpenShift Container Platform web console to modify the machine config pool (MCP) to prevent the MCO from making any changes to nodes in that pool. This prevents any reboots that would normally be part of the MCO update process.
Pausing an MCP stops all updates to your RHCOS nodes, including updates to the operating system, security, certificate, and any other updates related to the machine config. Pausing should be done for short periods of time only.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role.
Procedure
To pause or unpause automatic MCO update rebooting:
Pause the autoreboot process:
-
Log in to the OpenShift Container Platform web console as a user with the
cluster-admin
role. -
Click Compute
Machine Config Pools. - On the Machine Config Pools page, click either master or worker, depending upon which nodes you want to pause rebooting for.
- On the master or worker page, click YAML.
In the YAML, update the
spec.paused
field totrue
.Sample MachineConfigPool object
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Update the
spec.paused
field totrue
to pause rebooting.
To verify that the MCP is paused, return to the Machine Config Pools page.
On the Machine Config Pools page, the Paused column reports True for the MCP you modified.
If the MCP has pending changes while paused, the Updated column is False and Updating is False. When Updated is True and Updating is False, there are no pending changes.
ImportantIf there are pending changes (where both the Updated and Updating columns are False), it is recommended to schedule a maintenance window for a reboot as early as possible. Use the following steps for unpausing the autoreboot process to apply the changes that were queued since the last reboot.
-
Log in to the OpenShift Container Platform web console as a user with the
Unpause the autoreboot process:
-
Log in to the OpenShift Container Platform web console as a user with the
cluster-admin
role. -
Click Compute
Machine Config Pools. - On the Machine Config Pools page, click either master or worker, depending upon which nodes you want to pause rebooting for.
- On the master or worker page, click YAML.
In the YAML, update the
spec.paused
field tofalse
.Sample MachineConfigPool object
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Update the
spec.paused
field tofalse
to allow rebooting.
NoteBy unpausing an MCP, the MCO applies all paused changes reboots Red Hat Enterprise Linux CoreOS (RHCOS) as needed.
To verify that the MCP is paused, return to the Machine Config Pools page.
On the Machine Config Pools page, the Paused column reports False for the MCP you modified.
If the MCP is applying any pending changes, the Updated column is False and the Updating column is True. When Updated is True and Updating is False, there are no further changes being made.
-
Log in to the OpenShift Container Platform web console as a user with the
5.4.5.2. Disabling the Machine Config Operator from automatically rebooting by using the CLI Copia collegamentoCollegamento copiato negli appunti!
To avoid unwanted disruptions from changes made by the Machine Config Operator (MCO), you can modify the machine config pool (MCP) using the OpenShift CLI (oc) to prevent the MCO from making any changes to nodes in that pool. This prevents any reboots that would normally be part of the MCO update process.
Pausing an MCP stops all updates to your RHCOS nodes, including updates to the operating system, security, certificate, as well as any other updates related to the machine config. Pausing should be done for short periods of time only.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
).
Procedure
To pause or unpause automatic MCO update rebooting:
Pause the autoreboot process:
Update the
MachineConfigPool
custom resource to set thespec.paused
field totrue
.Control plane (master) nodes
oc patch --type=merge --patch='{"spec":{"paused":true}}' machineconfigpool/master
$ oc patch --type=merge --patch='{"spec":{"paused":true}}' machineconfigpool/master
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Worker nodes
oc patch --type=merge --patch='{"spec":{"paused":true}}' machineconfigpool/worker
$ oc patch --type=merge --patch='{"spec":{"paused":true}}' machineconfigpool/worker
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the MCP is paused:
Control plane (master) nodes
oc get machineconfigpool/master --template='{{.spec.paused}}'
$ oc get machineconfigpool/master --template='{{.spec.paused}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Worker nodes
oc get machineconfigpool/worker --template='{{.spec.paused}}'
$ oc get machineconfigpool/worker --template='{{.spec.paused}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
true
true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
spec.paused
field istrue
and the MCP is paused.Determine if the MCP has pending changes:
oc get machineconfigpool
# oc get machineconfigpool
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME CONFIG UPDATED UPDATING master rendered-master-33cf0a1254318755d7b48002c597bf91 True False worker rendered-worker-e405a5bdb0db1295acea08bcca33fa60 False False
NAME CONFIG UPDATED UPDATING master rendered-master-33cf0a1254318755d7b48002c597bf91 True False worker rendered-worker-e405a5bdb0db1295acea08bcca33fa60 False False
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the UPDATED column is False and UPDATING is False, there are pending changes. When UPDATED is True and UPDATING is False, there are no pending changes. In the previous example, the worker node has pending changes. The master node does not have any pending changes.
ImportantIf there are pending changes (where both the Updated and Updating columns are False), it is recommended to schedule a maintenance window for a reboot as early as possible. Use the following steps for unpausing the autoreboot process to apply the changes that were queued since the last reboot.
Unpause the autoreboot process:
Update the
MachineConfigPool
custom resource to set thespec.paused
field tofalse
.Control plane (master) nodes
oc patch --type=merge --patch='{"spec":{"paused":false}}' machineconfigpool/master
$ oc patch --type=merge --patch='{"spec":{"paused":false}}' machineconfigpool/master
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Worker nodes
oc patch --type=merge --patch='{"spec":{"paused":false}}' machineconfigpool/worker
$ oc patch --type=merge --patch='{"spec":{"paused":false}}' machineconfigpool/worker
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteBy unpausing an MCP, the MCO applies all paused changes and reboots Red Hat Enterprise Linux CoreOS (RHCOS) as needed.
Verify that the MCP is unpaused:
Control plane (master) nodes
oc get machineconfigpool/master --template='{{.spec.paused}}'
$ oc get machineconfigpool/master --template='{{.spec.paused}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Worker nodes
oc get machineconfigpool/worker --template='{{.spec.paused}}'
$ oc get machineconfigpool/worker --template='{{.spec.paused}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
false
false
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
spec.paused
field isfalse
and the MCP is unpaused.Determine if the MCP has pending changes:
oc get machineconfigpool
$ oc get machineconfigpool
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME CONFIG UPDATED UPDATING master rendered-master-546383f80705bd5aeaba93 True False worker rendered-worker-b4c51bb33ccaae6fc4a6a5 False True
NAME CONFIG UPDATED UPDATING master rendered-master-546383f80705bd5aeaba93 True False worker rendered-worker-b4c51bb33ccaae6fc4a6a5 False True
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the MCP is applying any pending changes, the UPDATED column is False and the UPDATING column is True. When UPDATED is True and UPDATING is False, there are no further changes being made. In the previous example, the MCO is updating the worker node.
5.5. Investigating pod issues Copia collegamentoCollegamento copiato negli appunti!
OpenShift Container Platform leverages the Kubernetes concept of a pod, which is one or more containers deployed together on one host. A pod is the smallest compute unit that can be defined, deployed, and managed on OpenShift Container Platform 4.5.
After a pod is defined, it is assigned to run on a node until its containers exit, or until it is removed. Depending on policy and exit code, Pods are either removed after exiting or retained so that their logs can be accessed.
The first thing to check when pod issues arise is the pod’s status. If an explicit pod failure has occurred, observe the pod’s error state to identify specific image, container, or pod network issues. Focus diagnostic data collection according to the error state. Review pod event messages, as well as pod and container log information. Diagnose issues dynamically by accessing running Pods on the command line, or start a debug pod with root access based on a problematic pod’s deployment configuration.
5.5.1. Understanding pod error states Copia collegamentoCollegamento copiato negli appunti!
Pod failures return explicit error states that can be observed in the status
field in the output of oc get pods
. Pod error states cover image, container, and container network related failures.
The following table provides a list of pod error states along with their descriptions.
Pod error state | Description |
---|---|
| Generic image retrieval error. |
| Image retrieval failed and is backed off. |
| The specified image name was invalid. |
| Image inspection did not succeed. |
|
|
| When attempting to retrieve an image from a registry, an HTTP error was encountered. |
| The specified container is either not present or not managed by the kubelet, within the declared pod. |
| Container initialization failed. |
| None of the pod’s containers started successfully. |
| None of the pod’s containers were killed successfully. |
| A container has terminated. The kubelet will not attempt to restart it. |
| A container or image attempted to run with root privileges. |
| Pod sandbox creation did not succeed. |
| Pod sandbox configuration was not obtained. |
| A pod sandbox did not stop successfully. |
| Network initialization failed. |
| Network termination failed. |
5.5.2. Reviewing pod status Copia collegamentoCollegamento copiato negli appunti!
You can query pod status and error states. You can also query a pod’s associated deployment configuration and review base image availability.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
). -
skopeo
is installed.
Procedure
Switch into a project:
oc project <project_name>
$ oc project <project_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List pods running within the namespace, as well as pod status, error states, restarts, and age:
oc get pods
$ oc get pods
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Determine whether the namespace is managed by a deployment configuration:
oc status
$ oc status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the namespace is managed by a deployment configuration, the output includes the deployment configuration name and a base image reference.
Inspect the base image referenced in the preceding command’s output:
skopeo inspect docker://<image_reference>
$ skopeo inspect docker://<image_reference>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the base image reference is not correct, update the reference in the deployment configuration:
oc edit deployment/my-deployment
$ oc edit deployment/my-deployment
Copy to Clipboard Copied! Toggle word wrap Toggle overflow When deployment configuration changes on exit, the configuration will automatically redeploy. Watch pod status as the deployment progresses, to determine whether the issue has been resolved:
oc get pods -w
$ oc get pods -w
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review events within the namespace for diagnostic information relating to pod failures:
oc get events
$ oc get events
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.5.3. Inspecting pod and container logs Copia collegamentoCollegamento copiato negli appunti!
You can inspect pod and container logs for warnings and error messages related to explicit pod failures. Depending on policy and exit code, pod and container logs remain available after pods have been terminated.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
).
Procedure
Query logs for a specific pod:
oc logs <pod_name>
$ oc logs <pod_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Query logs for a specific container within a pod:
oc logs <pod_name> -c <container_name>
$ oc logs <pod_name> -c <container_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Logs retrieved using the preceding
oc logs
commands are composed of messages sent to stdout within pods or containers.Inspect logs contained in
/var/log/
within a pod.List log files and subdirectories contained in
/var/log
within a pod:oc exec <pod_name> ls -alh /var/log
$ oc exec <pod_name> ls -alh /var/log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Query a specific log file contained in
/var/log
within a pod:oc exec <pod_name> cat /var/log/<path_to_log>
$ oc exec <pod_name> cat /var/log/<path_to_log>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List log files and subdirectories contained in
/var/log
within a specific container:oc exec <pod_name> -c <container_name> ls /var/log
$ oc exec <pod_name> -c <container_name> ls /var/log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Query a specific log file contained in
/var/log
within a specific container:oc exec <pod_name> -c <container_name> cat /var/log/<path_to_log>
$ oc exec <pod_name> -c <container_name> cat /var/log/<path_to_log>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.5.4. Accessing running pods Copia collegamentoCollegamento copiato negli appunti!
You can review running pods dynamically by opening a shell inside a pod or by gaining network access through port forwarding.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
).
Procedure
Switch into the project that contains the pod you would like to access. This is necessary because the
oc rsh
command does not accept the-n
namespace option:oc project <namespace>
$ oc project <namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start a remote shell into a pod:
oc rsh <pod_name>
$ oc rsh <pod_name>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- If a pod has multiple containers,
oc rsh
defaults to the first container unless-c <container_name>
is specified.
Start a remote shell into a specific container within a pod:
oc rsh -c <container_name> pod/<pod_name>
$ oc rsh -c <container_name> pod/<pod_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a port forwarding session to a port on a pod:
oc port-forward <pod_name> <host_port>:<pod_port>
$ oc port-forward <pod_name> <host_port>:<pod_port>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Enter
Ctrl+C
to cancel the port forwarding session.
5.5.5. Starting debug pods with root access Copia collegamentoCollegamento copiato negli appunti!
You can start a debug pod with root access, based on a problematic pod’s deployment or deployment configuration. Pod users typically run with non-root privileges, but running troubleshooting pods with temporary root privileges can be useful during issue investigation.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
).
Procedure
Start a debug pod with root access, based on a deployment.
Obtain a project’s deployment name:
oc get deployment -n <project_name>
$ oc get deployment -n <project_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start a debug pod with root privileges, based on the deployment:
oc debug deployment/my-deployment --as-root -n <project_name>
$ oc debug deployment/my-deployment --as-root -n <project_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Start a debug pod with root access, based on a deployment configuration.
Obtain a project’s deployment configuration name:
oc get deploymentconfigs -n <project_name>
$ oc get deploymentconfigs -n <project_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start a debug pod with root privileges, based on the deployment configuration:
oc debug deploymentconfig/my-deployment-configuration --as-root -n <project_name>
$ oc debug deploymentconfig/my-deployment-configuration --as-root -n <project_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can append -- <command>
to the preceding oc debug
commands to run individual commands within a debug pod, instead of running an interactive shell.
5.5.6. Copying files to and from pods and containers Copia collegamentoCollegamento copiato negli appunti!
You can copy files to and from a pod to test configuration changes or gather diagnostic information.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
).
Procedure
Copy a file to a pod:
oc cp <local_path> <pod_name>:/<path> -c <container_name>
$ oc cp <local_path> <pod_name>:/<path> -c <container_name>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The first container in a pod is selected if the
-c
option is not specified.
Copy a file from a pod:
oc cp <pod_name>:/<path> -c <container_name><local_path>
$ oc cp <pod_name>:/<path> -c <container_name><local_path>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The first container in a pod is selected if the
-c
option is not specified.
NoteFor
oc cp
to function, thetar
binary must be available within the container.
5.6. Troubleshooting the Source-to-Image process Copia collegamentoCollegamento copiato negli appunti!
5.6.1. Strategies for Source-to-Image troubleshooting Copia collegamentoCollegamento copiato negli appunti!
Use Source-to-Image (S2I) to build reproducible, Docker-formatted container images. You can create ready-to-run images by injecting application source code into a container image and assembling a new image. The new image incorporates the base image (the builder) and built source.
To determine where in the S2I process a failure occurs, you can observe the state of the pods relating to each of the following S2I stages:
- During the build configuration stage, a build pod is used to create an application container image from a base image and application source code.
- During the deployment configuration stage, a deployment pod is used to deploy application pods from the application container image that was built in the build configuration stage. The deployment pod also deploys other resources such as services and routes. The deployment configuration begins after the build configuration succeeds.
-
After the deployment pod has started the application pods, application failures can occur within the running application pods. For instance, an application might not behave as expected even though the application pods are in a
Running
state. In this scenario, you can access running application pods to investigate application failures within a pod.
When troubleshooting S2I issues, follow this strategy:
- Monitor build, deployment, and application pod status
- Determine the stage of the S2I process where the problem occurred
- Review logs corresponding to the failed stage
5.6.2. Gathering Source-to-Image diagnostic data Copia collegamentoCollegamento copiato negli appunti!
The S2I tool runs a build pod and a deployment pod in sequence. The deployment pod is responsible for deploying the application pods based on the application container image created in the build stage. Watch build, deployment and application pod status to determine where in the S2I process a failure occurs. Then, focus diagnostic data collection accordingly.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. - Your API service is still functional.
-
You have installed the OpenShift CLI (
oc
).
Procedure
Watch the pod status throughout the S2I process to determine at which stage a failure occurs:
oc get pods -w
$ oc get pods -w
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Use
-w
to monitor pods for changes until you quit the command usingCtrl+C
.
Review a failed pod’s logs for errors.
If the build pod fails, review the build pod’s logs:
oc logs -f pod/<application_name>-<build_number>-build
$ oc logs -f pod/<application_name>-<build_number>-build
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteAlternatively, you can review the build configuration’s logs using
oc logs -f bc/<application_name>
. The build configuration’s logs include the logs from the build pod.If the deployment pod fails, review the deployment pod’s logs:
oc logs -f pod/<application_name>-<build_number>-deploy
$ oc logs -f pod/<application_name>-<build_number>-deploy
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteAlternatively, you can review the deployment configuration’s logs using
oc logs -f dc/<application_name>
. This outputs logs from the deployment pod until the deployment pod completes successfully. The command outputs logs from the application pods if you run it after the deployment pod has completed. After a deployment pod completes, its logs can still be accessed by runningoc logs -f pod/<application_name>-<build_number>-deploy
.If an application pod fails, or if an application is not behaving as expected within a running application pod, review the application pod’s logs:
oc logs -f pod/<application_name>-<build_number>-<random_string>
$ oc logs -f pod/<application_name>-<build_number>-<random_string>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.6.3. Gathering application diagnostic data to investigate application failures Copia collegamentoCollegamento copiato negli appunti!
Application failures can occur within running application pods. In these situations, you can retrieve diagnostic information with these strategies:
- Review events relating to the application pods.
- Review the logs from the application pods, including application-specific log files that are not collected by the OpenShift Container Platform logging framework.
- Test application functionality interactively and run diagnostic tools in an application container.
Prerequisites
-
You have access to the cluster as a user with the
cluster-admin
role. -
You have installed the OpenShift CLI (
oc
).
Procedure
List events relating to a specific application pod. The following example retrieves events for an application pod named
my-app-1-akdlg
:oc describe pod/my-app-1-akdlg
$ oc describe pod/my-app-1-akdlg
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Review logs from an application pod:
oc logs -f pod/my-app-1-akdlg
$ oc logs -f pod/my-app-1-akdlg
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Query specific logs within a running application pod. Logs that are sent to stdout are collected by the OpenShift Container Platform logging framework and are included in the output of the preceding command. The following query is only required for logs that are not sent to stdout.
If an application log can be accessed without root privileges within a pod, concatenate the log file as follows:
oc exec my-app-1-akdlg -- cat /var/log/my-application.log
$ oc exec my-app-1-akdlg -- cat /var/log/my-application.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If root access is required to view an application log, you can start a debug container with root privileges and then view the log file from within the container. Start the debug container from the project’s
DeploymentConfig
object. Pod users typically run with non-root privileges, but running troubleshooting pods with temporary root privileges can be useful during issue investigation:oc debug dc/my-deployment-configuration --as-root -- cat /var/log/my-application.log
$ oc debug dc/my-deployment-configuration --as-root -- cat /var/log/my-application.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can access an interactive shell with root access within the debug pod if you run
oc debug dc/<deployment_configuration> --as-root
without appending-- <command>
.
Test application functionality interactively and run diagnostic tools, in an application container with an interactive shell.
Start an interactive shell on the application container:
oc exec -it my-app-1-akdlg /bin/bash
$ oc exec -it my-app-1-akdlg /bin/bash
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Test application functionality interactively from within the shell. For example, you can run the container’s entry point command and observe the results. Then, test changes from the command line directly, before updating the source code and rebuilding the application container through the S2I process.
Run diagnostic binaries available within the container.
NoteRoot privileges are required to run some diagnostic binaries. In these situations you can start a debug pod with root access, based on a problematic pod’s
DeploymentConfig
object, by runningoc debug dc/<deployment_configuration> --as-root
. Then, you can run diagnostic binaries as root from within the debug pod.
If diagnostic binaries are not available within a container, you can run a host’s diagnostic binaries within a container’s namespace by using
nsenter
. The following example runsip ad
within a container’s namespace, using the host`sip
binary.Enter into a debug session on the target node. This step instantiates a debug pod called
<node_name>-debug
:oc debug node/my-cluster-node
$ oc debug node/my-cluster-node
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set
/host
as the root directory within the debug shell. The debug pod mounts the host’s root file system in/host
within the pod. By changing the root directory to/host
, you can run binaries contained in the host’s executable paths:chroot /host
# chroot /host
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteOpenShift 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. However, if the OpenShift Container Platform API is not available, or the kubelet is not properly functioning on the target node,
oc
operations will be impacted. In such situations, it is possible to access nodes usingssh core@<node>.<cluster_name>.<base_domain>
instead.Determine the target container ID:
crictl ps
# crictl ps
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Determine the container’s process ID. In this example, the target container ID is
a7fe32346b120
:crictl inspect a7fe32346b120 --output yaml | grep 'pid:' | awk '{print $2}'
# crictl inspect a7fe32346b120 --output yaml | grep 'pid:' | awk '{print $2}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run
ip ad
within the container’s namespace, using the host’sip
binary. This example uses31150
as the container’s process ID. Thensenter
command enters the namespace of a target process and runs a command in its namespace. Because the target process in this example is a container’s process ID, theip ad
command is run in the container’s namespace from the host:nsenter -n -t 31150 -- ip ad
# nsenter -n -t 31150 -- ip ad
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteRunning a host’s diagnostic binaries within a container’s namespace is only possible if you are using a privileged container such as a debug node.
5.6.4. Additional resources Copia collegamentoCollegamento copiato negli appunti!
- See Source-to-Image (S2I) build for more details about the S2I build strategy.
5.7. Troubleshooting storage issues Copia collegamentoCollegamento copiato negli appunti!
5.7.1. Resolving multi-attach errors Copia collegamentoCollegamento copiato negli appunti!
When a node crashes or shuts down abruptly, the attached ReadWriteOnce (RWO) volume is expected to be unmounted from the node so that it can be used by a pod scheduled on another node.
However, mounting on a new node is not possible because the failed node is unable to unmount the attached volume.
A multi-attach error is reported:
Example output
Unable to attach or mount volumes: unmounted volumes=[sso-mysql-pvol], unattached volumes=[sso-mysql-pvol default-token-x4rzc]: timed out waiting for the condition Multi-Attach error for volume "pvc-8837384d-69d7-40b2-b2e6-5df86943eef9" Volume is already used by pod(s) sso-mysql-1-ns6b4
Unable to attach or mount volumes: unmounted volumes=[sso-mysql-pvol], unattached volumes=[sso-mysql-pvol default-token-x4rzc]: timed out waiting for the condition
Multi-Attach error for volume "pvc-8837384d-69d7-40b2-b2e6-5df86943eef9" Volume is already used by pod(s) sso-mysql-1-ns6b4
Procedure
To resolve the multi-attach issue, use one of the following solutions:
Enable multiple attachments by using RWX volumes.
For most storage solutions, you can use ReadWriteMany (RWX) volumes to prevent multi-attach errors.
Recover or delete the failed node when using an RWO volume.
For storage that does not support RWX, such as VMware vSphere, RWO volumes must be used instead. However, RWO volumes cannot be mounted on multiple nodes.
If you encounter a multi-attach error message with an RWO volume, force delete the pod on a shutdown or crashed node to avoid data loss in critical workloads, such as when dynamic persistent volumes are attached.
oc delete pod <old_pod> --force=true --grace-period=0s
$ oc delete pod <old_pod> --force=true --grace-period=0s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command deletes the volumes stuck on shutdown or crashed nodes after six minutes.
5.8. Diagnosing OpenShift CLI (oc) issues Copia collegamentoCollegamento copiato negli appunti!
5.8.1. Understanding OpenShift CLI (oc) log levels Copia collegamentoCollegamento copiato negli appunti!
With the OpenShift CLI (oc
), you can create applications and manage OpenShift Container Platform projects from a terminal.
If oc
command-specific issues arise, increase the oc
log level to output API request, API response, and curl
request details generated by the command. This provides a granular view of a particular oc
command’s underlying operation, which in turn might provide insight into the nature of a failure.
oc
log levels range from 1 to 10. The following table provides a list of oc
log levels, along with their descriptions.
Log level | Description |
---|---|
1 to 5 | No additional logging to stderr. |
6 | Log API requests to stderr. |
7 | Log API requests and headers to stderr. |
8 | Log API requests, headers, and body, plus API response headers and body to stderr. |
9 |
Log API requests, headers, and body, API response headers and body, plus |
10 |
Log API requests, headers, and body, API response headers and body, plus |
5.8.2. Specifying OpenShift CLI (oc) log levels Copia collegamentoCollegamento copiato negli appunti!
You can investigate OpenShift CLI (oc
) issues by increasing the command’s log level.
Prerequisites
-
You have installed the OpenShift CLI (
oc
).
Procedure
Specify the
oc
log level when running anoc
command:oc <options> --loglevel <log_level>
$ oc <options> --loglevel <log_level>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The OpenShift Container Platform user’s current session token is typically included in logged
curl
requests where required. You can also obtain the current user’s session token manually, for use when testing aspects of anoc
command’s underlying process step by step:oc whoami -t
$ oc whoami -t
Copy to Clipboard Copied! Toggle word wrap Toggle overflow