No description
Find a file
2026-06-09 15:14:34 +03:00
.gitignore Initial release: poll until node Ready or NotReady. 2026-06-09 15:14:34 +03:00
LICENSE Initial release: poll until node Ready or NotReady. 2026-06-09 15:14:34 +03:00
README.md Initial release: poll until node Ready or NotReady. 2026-06-09 15:14:34 +03:00
wait-for-k8s-node-ready.sh Initial release: poll until node Ready or NotReady. 2026-06-09 15:14:34 +03:00

wait-for-k8s-node-ready

Poll until a Kubernetes node reaches Ready or NotReady.

Problem

Node maintenance scripts (drain, reboot, uncordon) need a reliable wait loop instead of fixed sleep calls. This script polls kubectl until the node reports the desired Ready condition or a timeout is reached.

Requirements

  • bash
  • kubectl configured for the target cluster
  • Permission to get nodes

Usage

./wait-for-k8s-node-ready.sh <node-name> <ready|notready> [timeout_seconds]

Examples:

./wait-for-k8s-node-ready.sh worker-1 notready 180
./wait-for-k8s-node-ready.sh worker-1 ready 600

Exit code 0 on success, 1 on timeout or invalid arguments.

Limits

  • Watches the Ready condition only.
  • Uses the current kubectl context; no context flag is provided.
  • Progress is printed as dots every two seconds.

License

MIT — see LICENSE.