Update command outputs to k8s 1.13 based and split command outputs (#13014)
* Update command outputs to k8s 1.13 based and split command outputs * Add comments before commands * fix comments for consistency reasonpull/13747/head
parent
0ceb362beb
commit
49ef5c3486
|
@ -42,6 +42,9 @@ Note that the label key `jobgroup` is not special to Kubernetes. You can pick yo
|
|||
Next, expand the template into multiple files, one for each item to be processed.
|
||||
|
||||
```shell
|
||||
# Download job-templ.yaml
|
||||
curl -L -s -O https://k8s.io/examples/application/job/job-tmpl.yaml
|
||||
|
||||
# Expand files into a temporary directory
|
||||
mkdir ./jobs
|
||||
for i in apple banana cherry
|
||||
|
@ -54,6 +57,11 @@ Check if it worked:
|
|||
|
||||
```shell
|
||||
ls jobs/
|
||||
```
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
```
|
||||
job-apple.yaml
|
||||
job-banana.yaml
|
||||
job-cherry.yaml
|
||||
|
@ -67,19 +75,29 @@ Next, create all the jobs with one kubectl command:
|
|||
|
||||
```shell
|
||||
kubectl create -f ./jobs
|
||||
job "process-item-apple" created
|
||||
job "process-item-banana" created
|
||||
job "process-item-cherry" created
|
||||
```
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
```
|
||||
job.batch/process-item-apple created
|
||||
job.batch/process-item-banana created
|
||||
job.batch/process-item-cherry created
|
||||
```
|
||||
|
||||
Now, check on the jobs:
|
||||
|
||||
```shell
|
||||
kubectl get jobs -l jobgroup=jobexample
|
||||
NAME DESIRED SUCCESSFUL AGE
|
||||
process-item-apple 1 1 31s
|
||||
process-item-banana 1 1 31s
|
||||
process-item-cherry 1 1 31s
|
||||
```
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
```
|
||||
NAME COMPLETIONS DURATION AGE
|
||||
process-item-apple 1/1 14s 20s
|
||||
process-item-banana 1/1 12s 20s
|
||||
process-item-cherry 1/1 12s 20s
|
||||
```
|
||||
|
||||
Here we use the `-l` option to select all jobs that are part of this
|
||||
|
@ -90,6 +108,11 @@ We can check on the pods as well using the same label selector:
|
|||
|
||||
```shell
|
||||
kubectl get pods -l jobgroup=jobexample
|
||||
```
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
process-item-apple-kixwv 0/1 Completed 0 4m
|
||||
process-item-banana-wrsf7 0/1 Completed 0 4m
|
||||
|
@ -104,6 +127,11 @@ for p in $(kubectl get pods -l jobgroup=jobexample -o name)
|
|||
do
|
||||
kubectl logs $p
|
||||
done
|
||||
```
|
||||
|
||||
The output is:
|
||||
|
||||
```
|
||||
Processing item apple
|
||||
Processing item banana
|
||||
Processing item cherry
|
||||
|
|
Loading…
Reference in New Issue