Jobs & CronJobs
Jobs and CronJobs are controllers for running finite or recurring tasks. Unlike Deployments or StatefulSets that keep pods running continuously, Jobs run tasks to completion, and CronJobs run Jobs on a schedule.
Key benefits:
- Run to completion - Pods finish the task and stop
- Retry failed tasks - Automatically retry based on backoff policy
- Parallel execution - Multiple Pods can run simultaneously
- Scheduled tasks - CronJobs run tasks at specific times
- Track history - Monitor successful and failed completions
When to Use Jobs & CronJobs
Use Jobs for:
- Database migrations and schema updates
- Data processing and ETL operations
- One-time setup tasks and initialization
- Backup operations and file processing
Use CronJobs for:
- Regular backups (daily, weekly)
- Cleanup tasks and log rotation
- Report generation and data synchronization
- Periodic health checks and monitoring