“控制器CronJob”的版本间的差异
跳到导航
跳到搜索
(创建页面,内容为“=start= <pre> root@ubuntu-200470-1:~/cronjob# kubectl create -f cronjob.yaml Warning: batch/v1beta1 CronJob is deprecated in v1.21+, unavailable in v1.25+; use…”) |
(→start) |
||
第2行: | 第2行: | ||
<pre> | <pre> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | 00470-1:~/cronjob# kubectl get jobs --watch | ||
+ | |||
+ | NAME COMPLETIONS DURATION AGE | ||
+ | hello-28276275 1/1 21s 3m1s | ||
+ | hello-28276276 1/1 19s 2m1s | ||
+ | hello-28276277 1/1 22s 61s | ||
+ | hello-28276278 0/1 1s 1s | ||
+ | process-item-apple 1/1 65s 15m | ||
+ | process-item-banana 1/1 68s 15m | ||
+ | process-item-cherry 1/1 66s 15m | ||
+ | ^Croot@ubuntu-200470-1:~/cronjob# pods=$(kubectl get pods --selector=job-name=hello-28276276 --output=jsonpath={.items[*].metadata.name}) | ||
+ | root@ubuntu-200470-1:~/cronjob# | ||
+ | root@ubuntu-200470-1:~/cronjob# echo $pods | ||
+ | hello-28276276-fn86r | ||
+ | root@ubuntu-200470-1:~/cronjob# kubectl logs $pods | ||
+ | Fri Oct 6 07:16:07 UTC 2023 | ||
+ | Hello from the Kubernetes cluster | ||
+ | |||
+ | |||
2023年10月6日 (五) 07:21的版本
start
00470-1:~/cronjob# kubectl get jobs --watch NAME COMPLETIONS DURATION AGE hello-28276275 1/1 21s 3m1s hello-28276276 1/1 19s 2m1s hello-28276277 1/1 22s 61s hello-28276278 0/1 1s 1s process-item-apple 1/1 65s 15m process-item-banana 1/1 68s 15m process-item-cherry 1/1 66s 15m ^Croot@ubuntu-200470-1:~/cronjob# pods=$(kubectl get pods --selector=job-name=hello-28276276 --output=jsonpath={.items[*].metadata.name}) root@ubuntu-200470-1:~/cronjob# root@ubuntu-200470-1:~/cronjob# echo $pods hello-28276276-fn86r root@ubuntu-200470-1:~/cronjob# kubectl logs $pods Fri Oct 6 07:16:07 UTC 2023 Hello from the Kubernetes cluster root@ubuntu-200470-1:~/cronjob# kubectl create -f cronjob.yaml Warning: batch/v1beta1 CronJob is deprecated in v1.21+, unavailable in v1.25+; use batch/v1 CronJob cronjob.batch/hello created