Sign In

Curriculum 18: Jobs & CronJobs

Monitoring Jobs

10 min · 25 XP

Monitoring Jobs

Tracking Job progress and diagnosing failures is essential for reliable batch processing. Kubernetes provides several commands to monitor Job status, inspect pod outcomes, and track completions.

Checking Job Status

# List all jobs with completion status
kubectl get jobs

# Watch job progress in real time
kubectl get jobs --watch

# Output:
# NAME             COMPLETIONS   DURATION   AGE
# data-export      2/5           45s        45s

The COMPLETIONS column shows completed pods versus the required total. DURATION shows elapsed time since the Job started.

Viewing Job Pods

# List pods created by a specific job
kubectl get pods --selector=job-name=data-export

# Show pod status details
kubectl get pods --selector=job-name=data-export -o wide

Pod statuses to watch for:

  • Completed -- the pod finished successfully
  • Error -- the pod exited with a non-zero code
  • CrashLoopBackOff -- the pod keeps failing (check backoffLimit)

Reading Job Logs

# Logs from the job (selects a pod automatically)
kubectl logs job/data-export

# Logs from a specific pod
kubectl logs data-export-abc12

# Follow logs in real time
kubectl logs job/data-export --follow

Detailed Job Inspection

kubectl describe job data-export

The describe output shows:

  • Pods Statuses -- counts of active, succeeded, and failed pods
  • Events -- creation, completion, and failure events
  • Conditions -- whether the Job is Complete or Failed

Filtering Jobs by Status

# Find failed jobs
kubectl get jobs --field-selector status.successful=0

# Check events for recent job activity
kubectl get events --field-selector reason=BackoffLimitExceeded

These commands help you quickly identify problematic Jobs across your cluster.