Kahibaro
Discord Login Register

16.3 Node maintenance

Goals of Node Maintenance in OpenShift

Node maintenance in OpenShift focuses on keeping worker and control plane nodes healthy and up to date while minimizing disruption to running workloads. In practice this means:

This chapter concentrates on the mechanics and patterns specific to OpenShift nodes, assuming general cluster lifecycle concepts are already covered elsewhere.

Node States and Scheduling Controls

OpenShift relies on Kubernetes primitives plus some OpenShift‑specific tooling to control when nodes accept workloads.

Unschedulable vs Ready

Two commonly used states:

You typically mark a node unschedulable before any disruptive maintenance to stop new workloads from landing while you evacuate existing ones.

Key tools:

Cordoning does not move existing pods; it only prevents new scheduling to that node.

Taints and Tolerations for Maintenance

Taints allow you to repel pods from a node unless they explicitly tolerate the taint.

A common maintenance pattern is to apply a taint such as:

Examples of usage during maintenance:

Taints are especially useful when:

Cordoning and taints are complementary:

Draining Nodes

Draining is the core workflow for taking a node out of service in a controlled way.

What Draining Does

When you run oc adm drain on a node, OpenShift will:

  1. Mark the node unschedulable (cordon).
  2. Evict or delete pods on that node, subject to:
    • Pod Disruption Budgets (PDBs)
    • DaemonSets
    • Static pods
    • Local storage
  3. Let the scheduler move pods to other nodes (where allowed).

The goal is to maintain application availability while freeing the node for maintenance.

Basic Drain Command

Common pattern:

oc adm drain <node-name> \
  --ignore-daemonsets \
  --delete-emptydir-data \
  --grace-period=60 \
  --timeout=600s

Key flags:

Interaction with Pod Disruption Budgets

PDBs limit simultaneous voluntary disruptions. During drain:

Typical operations pattern:

DaemonSets and Static Pods

Draining does not evict:

For these, you typically:

On worker nodes, DaemonSet workloads (logging agents, monitoring agents, CNI components) are expected to stop when the node is taken offline.

Typical Node Maintenance Workflow

A common pattern for planned maintenance on a worker node:

  1. Identify the node
    • E.g., oc get nodes and check labels/roles, or match hostnames to hardware.
  2. Cordon the node
    • oc adm cordon <node-name>
    • New pods will not schedule there.
  3. Drain the node
    • oc adm drain <node-name> --ignore-daemonsets --delete-emptydir-data
    • Monitor progress; resolve any blocking PDBs or “unmanaged” pods.
  4. Perform OS / firmware / hardware work
    • Reboot, apply OS patches, replace components, etc.
    • From OpenShift’s perspective the node is now idle/empty.
  5. Verify node health after maintenance
    • When the node comes back, ensure:
      • oc get node <node-name> shows Ready
      • Node conditions (e.g., DiskPressure, MemoryPressure) are False
      • Machine config/state is as expected (for clusters using MachineConfig / MCO)
  6. Uncordon the node
    • oc adm uncordon <node-name>
    • New pods can now be scheduled onto the node.
  7. Observe rescheduling behavior
    • Verify key workloads are distributed as desired.
    • Watch for unexpected concentration of pods on the restored node.

For control plane nodes, you typically follow vendor-documented, highly controlled procedures, often integrated with the cluster’s Machine API and MachineConfig Operator.

Using Machine API and MachineConfig for Node Lifecycle

In many OpenShift deployments (especially on cloud or virtual platforms), nodes are managed via:

These abstractions let you treat nodes more like cattle than pets.

Replacing Nodes vs In-Place Maintenance

Instead of patching and rebooting a node repeatedly, a common pattern is:

  1. Scale up: Add a new node (via MachineSet scaling).
  2. Evacuate old node:
    • Drain and eventually delete the corresponding Machine.
  3. Scale down: Let the platform remove the old VM/instance.

Advantages:

This pattern is particularly effective for:

Coordinating with MachineConfig Updates

MachineConfig defines desired OS-level configuration (kernel version, systemd units, etc.). When a MachineConfig changes:

For manual maintenance, you should:

Handling Different Node Roles

Node maintenance strategies differ slightly by role.

Worker Nodes

Typical considerations:

Infrastructure / Specialized Nodes

Some clusters designate specific nodes for:

Maintenance patterns:

Control Plane Nodes

Control plane node maintenance is more sensitive:

A general operational guideline:

Managing Capacity and Disruption Risk

Node maintenance always interacts with cluster capacity and SLA expectations.

Ensuring Sufficient Capacity

Before draining:

This capacity-aware approach reduces:

Staggered vs Parallel Maintenance

For large fleets:

Policies are often codified in:

Common Operational Scenarios

Routine OS Patching

Pattern:

  1. Build and validate new OS image (or MachineConfig).
  2. Scale out new nodes using the new image.
  3. Drain and remove nodes on the old image.
  4. Repeat iteratively across the fleet.

Benefits:

Hardware Replacement or Rack Work

Steps:

  1. Identify all nodes in the affected rack/cluster segment.
  2. For HA, ensure workloads are spread across other racks/zones.
  3. Drain and shut down affected nodes.
  4. Replace hardware / perform work.
  5. Bring nodes back, verify they rejoin correctly, then uncordon.

For critical applications, coordinate maintenance windows with application teams.

Node in Degraded or Unknown State

Symptoms:

Typical actions:

  1. Cordon the node to avoid new workloads.
  2. Drain if feasible without violating critical PDBs.
  3. Investigate OS-level issues (disk, filesystem, etc.).
  4. If the node is unstable, consider fully replacing it (via Machine API) rather than attempting complex repair.
  5. Monitor workloads after rebalancing to ensure no residual impact.

Automation and Best Practices

Automating Node Maintenance

Common automation techniques:

Automation should include:

Recommended Practices

Verifying Post-Maintenance Health

After any node maintenance, validate the cluster and workloads:

  1. Node health
    • oc get nodes
    • oc describe node <node-name> for conditions and resource capacity.
  2. Key platform components
    • Status of core OpenShift Operators (e.g., oc get co).
    • Check for degraded or progressing conditions.
  3. Workload distribution
    • Ensure pods are spread across nodes and zones as expected.
    • Look for unschedulable pods (Pending state) or repeated restarts.
  4. Application checks
    • Run lightweight synthetic tests or smoke tests against critical applications.
    • Confirm SLIs (latency, error rates) remain within expected ranges.

Closing the loop with verification ensures that maintenance not only completed, but did so without hidden side effects on cluster stability or application behavior.

Views: 59

Comments

Please login to add a comment.

Don't have an account? Register now!