kubectl wait
The kubectl command that blocks until a named condition on an object becomes true, or until a timeout expires.
In more detail
It turns the question is it ready yet into one command with a clear pass or fail, which makes scripts and smoke tests reliable. Common conditions are ready for pods and available for Deployments. A timeout is a failure you should investigate, not a reason to wait longer.
Example
kubectl wait --for=condition=ready pod/web --timeout=2mRelated terms
- status condition — A named true-or-false fact that a controller records in an object's status, such as Ready, Available or Accepted, with a reason and a time.
- smoke test — A quick test that checks the most basic behaviour works after a deploy, before deeper testing or real traffic.
Taught in
- Choose The Right Workload Resource — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Sidecars And Init Containers — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Persistent And Ephemeral Volumes — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Jobs And CronJobs That Behave — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Design And Build: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Container Logs — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ConfigMaps And Secrets — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ServiceAccounts And Tokens — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Configuration And Security: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- From Docker To Desired State — Kubernetes: Production-Grade Container Orchestration
- Control Plane: etcd, API Server, Scheduler, Controllers — Kubernetes: Production-Grade Container Orchestration
- Worker Nodes: kubelet, Runtime, CNI And kube-proxy — Kubernetes: Production-Grade Container Orchestration
- Troubleshooting: describe, Events And A First Smoke Test — Kubernetes: Production-Grade Container Orchestration
- Troubleshooting: A Timed Service Recovery Drill — Kubernetes: Production-Grade Container Orchestration