Skip to content

Commit 2fe6166

Browse files
committed
Add description of Job
Fixes #43.
1 parent 17c0035 commit 2fe6166

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

concepts/job.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,49 @@ spec:
5151
restartPolicy: Never
5252
```
5353
54-
```
54+
```sh
55+
# 创建Job
5556
$ kubectl create -f ./job.yaml
5657
job "pi" created
58+
# 查看Job的状态
59+
$ kubectl describe job pi
60+
Name: pi
61+
Namespace: default
62+
Selector: controller-uid=cd37a621-5b02-11e7-b56e-76933ddd7f55
63+
Labels: controller-uid=cd37a621-5b02-11e7-b56e-76933ddd7f55
64+
job-name=pi
65+
Annotations: <none>
66+
Parallelism: 1
67+
Completions: 1
68+
Start Time: Tue, 27 Jun 2017 14:35:24 +0800
69+
Pods Statuses: 0 Running / 1 Succeeded / 0 Failed
70+
Pod Template:
71+
Labels: controller-uid=cd37a621-5b02-11e7-b56e-76933ddd7f55
72+
job-name=pi
73+
Containers:
74+
pi:
75+
Image: perl
76+
Port:
77+
Command:
78+
perl
79+
-Mbignum=bpi
80+
-wle
81+
print bpi(2000)
82+
Environment: <none>
83+
Mounts: <none>
84+
Volumes: <none>
85+
Events:
86+
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
87+
--------- -------- ----- ---- ------------- -------- ------ -------
88+
2m 2m 1 job-controller Normal SuccessfulCreate Created pod: pi-nltxv
89+
90+
# 使用'job-name=pi'标签查询属于该Job的Pod
91+
# 注意不要忘记'--show-all'选项显示已经成功(或失败)的Pod
92+
$ kubectl get pod --show-all -l job-name=pi
93+
NAME READY STATUS RESTARTS AGE
94+
pi-nltxv 0/1 Completed 0 3m
95+
96+
# 使用jsonpath获取pod ID并查看Pod的日志
5797
$ pods=$(kubectl get pods --selector=job-name=pi --output=jsonpath={.items..metadata.name})
5898
$ kubectl logs $pods
5999
3.141592653589793238462643383279502...

0 commit comments

Comments
 (0)