I have attempted this question and i find my answer is correct but still it shows incorrect. Kindly help.
Question: For this question, please set the context to cluster1
by running:
kubectl config use-context cluster1
In the ckad-job
namespace, schedule a job called learning-every-minute
that prints this message in the shell every minute: I am practicing for CKAD certification
.
In case the container in pod failed for any reason, it should be restarted automatically.
Use busybox:1.28
image for the cronjob!
below is my answer:
apiVersion: batch/v1
kind: CronJob
metadata:
creationTimestamp: null
name: learning-every-minute
namespace: ckad-job
spec:
jobTemplate:
metadata:
creationTimestamp: null
name: learning-every-minute
spec:
template:
metadata:
creationTimestamp: null
spec:
containers:
- image: busybox:1.28
name: learning-every-minute
resources: {}
command: ["sh","-c","echo 'I am practicing for CKAD certification'"]
restartPolicy: OnFailure
schedule: '*/1 * * * *'
status: {}