[A-00241] Kubernetes 1000本ノック (5)
前回投稿はこちら
今回はKubernetest Jobを使ってみたいと思います。
とりあえず簡単なJobから作ってみます。
apiVersion: batch/v1
kind: Job
metadata:
name: test-job
labels:
app: test-job
spec:
template:
metadata:
labels:
app: test-job
spec:
containers:
- name: busybox
image: busybox:latest
command: [ "sh", "-c", "sleep 5; exit 0" ]
restartPolicy: Never
completions: 6
parallelism: 2
上記をapplyして実行結果を確認します。
user@usernoMacBook-Pro % kubectl describe job test-job
Name: test-job
Namespace: default
Selector: batch.kubernetes.io/controller-uid=a679845a-5437-4f35-9e24-beb7905df816
Labels: app=test-job
Annotations: <none>
Parallelism: 2
Completions: 6
Completion Mode: NonIndexed
Suspend: false
Backoff Limit: 6
Start Time: Sat, 29 Mar 2025 18:23:14 +0900
Pods Statuses: 1 Active (1 Ready) / 5 Succeeded / 0 Failed
Pod Template:
Labels: app=test-job
batch.kubernetes.io/controller-uid=a679845a-5437-4f35-9e24-beb7905df816
batch.kubernetes.io/job-name=test-job
controller-uid=a679845a-5437-4f35-9e24-beb7905df816
job-name=test-job
Containers:
busybox:
Image: busybox:latest
Port: <none>
Host Port: <none>
Command:
sh
-c
sleep 5; exit 0
Environment: <none>
Mounts: <none>
Volumes: <none>
Node-Selectors: <none>
Tolerations: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulCreate 35s job-controller Created pod: test-job-cqbwq
Normal SuccessfulCreate 35s job-controller Created pod: test-job-75xws
Normal SuccessfulCreate 22s job-controller Created pod: test-job-nksct
Normal SuccessfulCreate 20s job-controller Created pod: test-job-wxftn
Normal SuccessfulCreate 11s job-controller Created pod: test-job-jtd2q
Normal SuccessfulCreate 8s job-controller Created pod: test-job-sdw97
・Appendix
参考文献はこちら
コメントを残す