cat job.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: mydatejob
spec:
template:
metadata:
spec:
containers:
- image: busybox
name: mydatejob
command:
- date
restartPolicy: Never
kubectl create -f job.yaml
job.batch/mydatejob created
kubectl get pods
NAME READY STATUS RESTARTS AGE
mydatejob-pt5tg 0/1 Completed 0 15s
kubectl get jobs
NAME COMPLETIONS DURATION AGE
mydatejob 1/1 6s 35s
kubectl logs mydatejob-pt5tg
Sat Jun 25 00:41:54 UTC 2022
kubectl delete job mydatejob
job.batch "mydatejob" deleted
No comments:
Post a Comment