911 B
911 B
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
bashkubectlconfigured 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
Readycondition only. - Uses the current
kubectlcontext; no context flag is provided. - Progress is printed as dots every two seconds.
License
MIT — see LICENSE.