Understanding node rebooting

    Another challenge is how to handle nodes that are running critical infrastructure such as the router or the registry. The same node evacuation process applies, though it is important to understand certain edge cases.

    When rebooting nodes that host critical OKD infrastructure components, such as router pods, registry pods, and monitoring pods, ensure that there are at least three nodes available to run these components.

    The following scenario demonstrates how service interruptions can occur with applications running on OKD when only two nodes are available:

    • Node A is marked unschedulable and all pods are evacuated.

    • The registry pod running on that node is now redeployed on node B. Node B is now running both registry pods.

    • Node B is now marked unschedulable and is evacuated.

    • The service exposing the two pod endpoints on node B loses all endpoints, for a brief period of time, until they are redeployed to node A.

    When using three nodes for infrastructure components, this process does not result in a service disruption. However, due to pod scheduling, the last node that is evacuated and brought back into rotation does not have a registry pod. One of the other nodes has two registry pods. To schedule the third registry pod on the last node, use pod anti-affinity to prevent the scheduler from locating two registry pods on the same node.

    Additional information

    • For more information on pod anti-affinity, see .

    Pod anti-affinity is slightly different than node anti-affinity. Node anti-affinity can be violated if there are no other suitable locations to deploy a pod. Pod anti-affinity can be set to either required or preferred.

    With this in place, if only two infrastructure nodes are available and one is rebooted, the container image registry pod is prevented from running on the other node. reports the pod as unready until a suitable node is available. Once a node is available and all pods are back in ready state, the next node can be restarted.

    Procedure

    To reboot a node using pod anti-affinity:

    1. This example assumes the container image registry pod has a label of registry=default. Pod anti-affinity can use any Kubernetes match expression.

    2. Perform a graceful restart of the node.

    In most cases, a pod running an OKD router exposes a host port.

    The PodFitsPorts scheduler predicate ensures that no router pods using the same port can run on the same node, and pod anti-affinity is achieved. If the routers are relying on IP failover for high availability, there is nothing else that is needed.

    For router pods relying on an external service such as AWS Elastic Load Balancing for high availability, it is that service’s responsibility to react to router pod restarts.

    In rare cases, a router pod may not have a host port configured. In those cases, it is important to follow the recommended restart process for infrastructure nodes.

    Before rebooting a node, it is recommended to backup etcd data to avoid any data loss on the node.

    Procedure

    To perform a graceful restart of a node:

    1. Mark the node as unschedulable:

      1. $ oc adm cordon <node1>
      1. $ oc adm drain <node1> --ignore-daemonsets --delete-emptydir-data --force

      You might receive errors that pods associated with custom pod disruption budgets (PDB) cannot be evicted.

      Example error

      1. error when evicting pods/"rails-postgresql-example-1-72v2w" -n "rails" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.

      In this case, run the drain command again, adding the disable-eviction flag, which bypasses the PDB checks:

      1. $ oc adm drain <node1> --ignore-daemonsets --delete-emptydir-data --force --disable-eviction
    2. Access the node in debug mode:

    3. Change your root directory to /host:

      1. $ chroot /host
    4. After the reboot is complete, mark the node as schedulable by running the following command:

    5. Verify that the node is ready:

      1. $ oc get node <node1>

      Example output

      1. NAME STATUS ROLES AGE VERSION
      2. <node1> Ready worker 6d22h v1.18.3+b0068a8

    Additional information