Create and Apply a Kubernetes Job with Completions and Parallelism
Scenario
Team Aurora needs a Kubernetes Job to run a short task across multiple pods. The Job must be saved as a reusable template file at /home/laborant/course/5/job.yaml and applied to the aurora namespace with specific parallelism, completion, and labeling requirements.
Your goal is to create the template and apply it correctly before the team's deadline.
Task
Create a Job template at /home/laborant/course/5/job.yaml and apply it to the aurora namespace.
The Job named aurora-batch-job should use image public.ecr.aws/docker/library/busybox:stable with container named aurora-batch-container executing the command sleep 2 && echo done.
Configure it to run 3 completions with 2 parallel runs at a time, and ensure every pod created carries the label id=stellar-task.
Hint
Use kubectl dry-run to generate a base manifest, then edit it to add completions, parallelism, container name, and the pod label before applying.
Labels on the pod template go under spec.template.metadata.labels, not at the Job level. The container name is set under spec.template.spec.containers[0].name.
# generate a base Job manifest
kubectl create job aurora-batch-job \
--image=public.ecr.aws/docker/library/busybox:stable \
--dry-run=client -o yaml -n aurora > /home/laborant/course/5/job.yaml
# edit the file
vi /home/laborant/course/5/job.yaml
# apply it
kubectl apply -f /home/laborant/course/5/job.yaml
# verify
kubectl get job aurora-batch-job -n aurora
kubectl get pods -n aurora --show-labels