Skip to content

Commit 5ed062f

Browse files
author
Tim Bannister
committed
Use kubectl to wait for Jobs to succeed
No need to poll: there's a subcommand for that.
1 parent c6ec678 commit 5ed062f

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

content/en/docs/tasks/job/coarse-parallel-processing-work-queue.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,13 @@ So, now run the Job:
244244
kubectl apply -f ./job.yaml
245245
```
246246

247-
Now wait a bit, then check on the job.
247+
You can wait for the Job to succeed, with a timeout:
248+
```shell
249+
# The check for condition name is case insensitive
250+
kubectl wait --for=condition=complete --timeout=300s job/job-wq-1
251+
```
252+
253+
Next, check on the Job:
248254

249255
```shell
250256
kubectl describe jobs/job-wq-1
@@ -285,7 +291,9 @@ Events:
285291
14s 14s 1 {job } Normal SuccessfulCreate Created pod: job-wq-1-p17e0
286292
```
287293

288-
All our pods succeeded. Yay.
294+
295+
296+
All the pods for that Job succeeded. Yay.
289297

290298

291299

content/en/docs/tasks/job/fine-parallel-processing-work-queue.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,18 @@ Events:
208208
FirstSeen LastSeen Count From SubobjectPath Type Reason Message
209209
--------- -------- ----- ---- ------------- -------- ------ -------
210210
33s 33s 1 {job-controller } Normal SuccessfulCreate Created pod: job-wq-2-lglf8
211+
```
211212

213+
You can wait for the Job to succeed, with a timeout:
214+
```shell
215+
# The check for condition name is case insensitive
216+
kubectl wait --for=condition=complete --timeout=300s job/job-wq-2
217+
```
212218

219+
```shell
213220
kubectl logs pods/job-wq-2-7r7b2
221+
```
222+
```
214223
Worker with sessionID: bbd72d0a-9e5c-4dd6-abf6-416cc267991f
215224
Initial queue state: empty=False
216225
Working on banana

content/en/docs/tasks/job/indexed-parallel-processing-static.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ When you create this Job, the control plane creates a series of Pods, one for ea
107107

108108
Because `.spec.parallelism` is less than `.spec.completions`, the control plane waits for some of the first Pods to complete before starting more of them.
109109

110-
Once you have created the Job, wait a moment then check on progress:
110+
You can wait for the Job to succeed, with a timeout:
111+
```shell
112+
# The check for condition name is case insensitive
113+
kubectl wait --for=condition=complete --timeout=300s job/indexed-job
114+
```
115+
116+
Now, describe the Job and check that it was successful.
117+
111118

112119
```shell
113120
kubectl describe jobs/indexed-job

0 commit comments

Comments
 (0)