File tree 2 files changed +51
-0
lines changed
2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -973,6 +973,40 @@ kubectl wait --for=condition=complete --timeout=600s job/pi
973
973
974
974
You have to set ` ttlSecondsAfterFinished ` in job spec.
975
975
976
+ ### Job With Generated Name
977
+
978
+ Create (not apply) job
979
+
980
+ ```
981
+ kubectl create -f job-generate-name.yml
982
+ ```
983
+
984
+ Delete all jobs
985
+
986
+ ```
987
+ kubectl delete job --all
988
+ ```
989
+
990
+ Example
991
+
992
+ ```
993
+ ondrej@sika-mac-air:~$ kubectl create -f job-generate-name.yml
994
+ job.batch/hello-4hjd4 created
995
+ ondrej@sika-mac-air:~$ kubectl create -f job-generate-name.yml
996
+ job.batch/hello-nrr8r created
997
+ ondrej@sika-mac-air:~$ kubectl create -f job-generate-name.yml
998
+ job.batch/hello-h8mjd created
999
+ ondrej@sika-mac-air:~$ kubectl get job
1000
+ NAME COMPLETIONS DURATION AGE
1001
+ hello-4hjd4 1/1 1s 5s
1002
+ hello-h8mjd 1/1 2s 3s
1003
+ hello-nrr8r 1/1 2s 4s
1004
+ ondrej@sika-mac-air:~$ kubectl delete job --all
1005
+ job.batch "hello-4hjd4" deleted
1006
+ job.batch "hello-h8mjd" deleted
1007
+ job.batch "hello-nrr8r" deleted
1008
+ ```
1009
+
976
1010
### Create Cron Job
977
1011
978
1012
- < https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/ >
Original file line number Diff line number Diff line change
1
+ apiVersion : batch/v1
2
+ kind : Job
3
+ metadata :
4
+ generateName : hello-
5
+ spec :
6
+ template :
7
+ metadata :
8
+ name : hello
9
+ spec :
10
+ containers :
11
+ - name : main
12
+ image : debian:11-slim
13
+ command : ["/bin/sh", "-c"]
14
+ args :
15
+ - |
16
+ echo Hello World!
17
+ restartPolicy : Never
You can’t perform that action at this time.
0 commit comments