Kubernetes Topics (3)Tap to view
    Kubernetes·Container Orchestration·Topic 3 of 3

    Kubernetes Cluster Troubleshooting & Nodes

    Commands for diagnosing nodes, isolating and maintaining servers (Cordon & Drain), tracking live events and monitoring resource consumption.

    1. Node Maintenance & Diagnostics

    1. kubectl get nodes -o wide

      What it doesDisplays the status of all cluster nodes with OS versions, IP addresses and Kubelet version

      When to use itTo verify the readiness of the nodes (Ready / NotReady) and the correctness of their connection to the Control Plane

      Examplekubectl get nodes -o wide

    2. kubectl describe node <node-name>

      What it doesDisplays comprehensive details about the node including resource constraints (Allocatable), tags, taints and pressure slices (DiskPressure/MemoryPressure)

      When to use itWhen new pods fail to be scheduled on the node or it switches to NotReady

      Examplekubectl describe node worker-node-01

    3. kubectl get events -A --sort-by=".metadata.creationTimestamp"

      What it doesFetches all block events sorted in ascending order by time of occurrence from newest to oldest

      When to use itTo track obscure problems in the cluster, such as allocation errors or failure of Liveness/Readiness health sensors

      Examplekubectl get events -A --sort-by=".metadata.creationTimestamp"

    4. kubectl top nodes

      What it doesDisplays the actual CPU and memory consumption of each node in the cluster

      When to use itTo evaluate resource pressure and identify nodes with high consumption (requires Metrics Server)

      Examplekubectl top nodes

    5. kubectl top pods -A --sort-by=cpu

      What it doesDisplays the most processor intensive pods across all namespaces

      When to use itto detect services with abnormal consumption and avoid exceeding the limits of available resources

      Examplekubectl top pods -A --sort-by=cpu

    6. kubectl cordon <node-name>

      What it doesMarks the node as SchedulingDisabled to prevent any new pods from being assigned to it

      When to use itAs a first step before performing maintenance or upgrade work on the server

      Examplekubectl cordon worker-node-02

    7. kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data

      What it doesEvicts all removable pods from the node and safely reschedules them on other nodes

      When to use itto completely unload the server before rebooting or upgrading the kernel and operating system

      Examplekubectl drain worker-node-02 --ignore-daemonsets --delete-emptydir-data

    8. kubectl uncordon <node-name>

      What it doesRemoves the blocking state and restores the node to be ready to receive and schedule new pods

      When to use itAfter completing the maintenance work and confirming the stability of the server and its return to work

      Examplekubectl uncordon worker-node-02

    Offline · Reading cached copy