changes.mady.by.user Sansae
Saved on Mar 04, 2024
Saved on Mar 06, 2024
...
https://dev-k8sref-io.web.app/docs/workloads/job-v1/
apiVersion: batch/v1
kind: Job
apiVersion: batch/v1 kind: Job metadata: name: pi spec: template: spec: containers: - name: pi image: perl:5.34.0 command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] restartPolicy: Never # 파드의 재시작 정책 설정 backoffLimit: 4 # 재시도 횟수 설정 activeDeadlineSeconds: 100 #파드의 실행시간 설정
sansae@sansaeAir15m2 k8s-lab-workspace % k apply -f job.yaml job.batch/pi created sansae@sansaeAir15m2 k8s-lab-workspace % k get all NAME READY STATUS RESTARTS AGE pod/pi-kz68s 1/1 Running 0 4s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 48s NAME COMPLETIONS DURATION AGE job.batch/pi 0/1 5s 5s sansae@sansaeAir15m2 k8s-lab-workspace % k get all NAME READY STATUS RESTARTS AGE pod/pi-kz68s 0/1 Completed 0 18s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 62s NAME COMPLETIONS DURATION AGE job.batch/pi 1/1 7s 18s sansae@sansaeAir15m2 k8s-lab-workspace % sansae@sansaeAir15m2 k8s-lab-workspace % k logs pi-pi-kz68s 3.14159265358979323846264338327950288419716939937510582 ~~~~~~~~~~~~ 생략 ~~~~~~~~~~~~~~~~ sansae@sansaeAir15m2 k8s-lab-workspace % k describe job pi Name: pi Namespace: default Selector: batch.kubernetes.io/controller-uid=3ba192aa-4cbf-4fa4-b037-bd449d249492 Labels: batch.kubernetes.io/controller-uid=3ba192aa-4cbf-4fa4-b037-bd449d249492 batch.kubernetes.io/job-name=pi controller-uid=3ba192aa-4cbf-4fa4-b037-bd449d249492 job-name=pi Annotations: batch.kubernetes.io/job-tracking: Parallelism: 1 Completions: 1 Completion Mode: NonIndexed Start Time: Sat, 09 Mar 2024 23:57:54 +0900 Completed At: Sat, 09 Mar 2024 23:58:01 +0900 Duration: 7s Active Deadline Seconds: 100s Pods Statuses: 0 Active (0 Ready) / 1 Succeeded / 0 Failed Pod Template: Labels: batch.kubernetes.io/controller-uid=3ba192aa-4cbf-4fa4-b037-bd449d249492 batch.kubernetes.io/job-name=pi controller-uid=3ba192aa-4cbf-4fa4-b037-bd449d249492 job-name=pi Containers: pi: Image: perl:5.34.0 Port: <none> Host Port: <none> Command: perl -Mbignum=bpi -wle print bpi(2000) Environment: <none> Mounts: <none> Volumes: <none> Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal SuccessfulCreate 40s job-controller Created pod: pi-kz68s Normal Completed 33s job-controller Job completed sansae@sansaeAir15m2 k8s-lab-workspace %