Kubernetes Jobs let us run workloads that finish and exit (like batch processing, ETL, or data analysis).
Sometimes, we don’t just want one Pod to complete—we may want multiple Pods to run and finish successfully before marking the Job as complete. This is where the completions field comes in.
🔹 Step 01: Introduction
- completions = how many Pods must successfully complete for the Job to be considered complete.
- Example:
completions: 4
means 4 Pods must complete successfully.
👉 In this demo, we’ll configure a Job with completions: 4.
🔹 Step 02: job3.yaml
Here’s the manifest for our Job:
apiVersion: batch/v1
kind: Job
metadata:
# Unique key of the Job instance
name: job3
spec:
template:
metadata:
name: job3
spec:
containers:
- name: job3
image: alpine
command: ['sh', '-c', 'echo Kubernetes Jobs Demo - Job Completions Test ; sleep 20']
# Do not restart containers after they exit
restartPolicy: Never
# backoffLimit: Number of retries before marking as failed.
backoffLimit: 4 # Default is 6
# completions: How many Pods must successfully complete
completions: 4
👉 This Job will run 4 Pods sequentially, each sleeping for 20 seconds, and only then be marked complete.
🔹 Step 03: Deploy and Verify
# Deploy Kubernetes Manifests
kubectl apply -f job3.yaml
# OR
kubectl create -f job3.yaml
Check Job & Pods
# List Jobs
kubectl get jobs
# Describe Job
kubectl describe job job3
# List Pods
kubectl get pods
Observations
- 4 Pods will be created (one after another).
- Each Pod runs → completes → next Pod starts.
- Job is only marked complete when all 4 Pods finish successfully.
✅ Example output:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
job3-6lq5m 0/1 Completed 0 110s
job3-ff98k 0/1 Completed 0 95s
job3-rbgqf 0/1 Completed 0 63s
job3-x6pd8 0/1 Completed 0 79s
$ kubectl get jobs
NAME COMPLETIONS DURATION AGE
job3 4/4 63s 115s
👉 Job is marked 4/4 completed ✅
🔹 Step 04: Clean-Up
# Delete the Job
kubectl delete job job3
🎯 Conclusion
- completions lets you control how many successful Pods are needed for a Job to finish.
- Example: completions: 4 → 4 Pods must complete.
- By default, completions: 1.
- Great for batch workloads where multiple Pods must run to finish the task.
🌟 Thanks for reading! If this post added value, a like ❤️, follow, or share would encourage me to keep creating more content.
— Latchu | Senior DevOps & Cloud Engineer
☁️ AWS | GCP | ☸️ Kubernetes | 🔐 Security | ⚡ Automation
📌 Sharing hands-on guides, best practices & real-world cloud solutions
Top comments (0)