You need to make sure that each pod scheduled as part of your Kubernetes job will have label myJobId="great job". How will you do that?
Experience Level: Junior
Tags: Kubernetes
Answer
Create a job manifest and save it to file by running the following command:
kubectl create job job1 --image=busybox --dry-run=client -o yaml -- /bin/sh -c 'echo hello' > job.yaml
Then edit the file by running the following command:
nano job.yaml
Find metadata.labels section in the template. Add the label.
Then save the file and run the following command
Related Kubernetes job interview questions
How do you display a history of job executions in Kubernetes?
Kubernetes JuniorYou were asked to create a command that will display a status of a pod pod1 in namespace ns1. What will you do?
Kubernetes JuniorHow do you create pod pod1 of image nginx in namespace ns1 that will have the container name c1?
Kubernetes MediorHow do you get a list of endpoints that are available for service service1?
Kubernetes MediorHow can you run a pod on each node of Kubernetes and make sure that it is running only once on on each node?
Kubernetes Medior