

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 8
click for more info
Not enough gems
Cost: 6 gems
1: Jobs
incomplete
2: CronJobs
incomplete
This lesson's interactive features are locked, please to keep using them
A CronJob creates a Job on a schedule. It's a lot like a "normal" cron job, but for Kubernetes.
The schedule uses the classic cron syntax, which is 5 fields separated by spaces:
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of the week (0 - 6, Sunday is 0)
│ │ │ │ │
* * * * *A * means "every". For example:
* * * * *: Every minute
0 * * * *: At the top of every hour
0 2 * * *: Every day at 2 AM
30 9 * * 1: Every Monday at 9:30 AM
A CronJob's jobTemplate is just a Job spec, so wrapping a Job in a schedule looks like this:
apiVersion: batch/v1
kind: CronJob
metadata:
name: synergychat-stats-report
spec:
schedule: "* * * * *"
jobTemplate:
spec:
backoffLimit: 4
template:
spec:
restartPolicy: Never
containers:
- name: synergychat-stats
image: curlimages/curl:latest
args:
- -sf
- http://crawler-service.crawler.svc.cluster.local/statsKubernetes keeps the last 3 successful Jobs and the last failed one, and deletes the rest, but if you want to, you can configure that with successfulJobsHistoryLimit and failedJobsHistoryLimit.
Schedule the stats report.
Make sure kubectl proxy is running, then run and submit the CLI tests.