Belajar Kubernetes - Episode 15 - Pengenalan dan Penjelasan CronJob

Belajar Kubernetes - Episode 15 - Pengenalan dan Penjelasan CronJob

Di episode ini kita akan coba bahas Kubernetes CronJob, controller untuk menjalankan Job berdasarkan time-based schedule. Kita akan mempelajari bagaimana CronJob enable scheduled task, recurring operation, dan automated maintenance di Kubernetes.

Arman Dwi Pangestu
Arman Dwi PangestuMarch 18, 2026
0 views
9 min read

Pendahuluan

Catatan

Untuk kalian yang ingin membaca episode sebelumnya, bisa click thumbnail episode 14 di bawah ini

Episode 14Episode 14

Di episode sebelumnya kita sudah belajar tentang Job, yang menjalankan task sampai completion. Selanjutnya di episode 15 kali ini, kita akan coba bahas CronJob, yang build on Job untuk menyediakan scheduled, recurring task execution.

Catatan: Disini saya akan menggunakan Kubernetes Cluster yang di install melalui K3s.

Jika kalian familiar dengan Unix/Linux cron, CronJob di Kubernetes bekerja mirip - dia membuat Job on a repeating schedule. Bayangkan seperti task scheduler cluster kalian untuk automated backup, report, cleanup, dan recurring operation apapun.

Apa Itu CronJob?

CronJob membuat Job berdasarkan time-based schedule. Dia menggunakan cron format yang sama seperti Unix/Linux system untuk define kapan Job harus run. CronJob mengelola lifecycle dari Job, membuatnya di scheduled time dan cleanup old Job.

Bayangkan CronJob seperti cron daemon di Linux - dia menjalankan task di specified time secara otomatis. Di Kubernetes, CronJob membuat Job object on schedule, yang kemudian membuat Pod untuk execute actual work.

Karakteristik kunci CronJob:

  • Scheduled execution - Menjalankan Job di specified time menggunakan cron syntax
  • Recurring task - Otomatis membuat Job on schedule
  • Job management - Mengelola Job creation dan cleanup
  • Concurrency control - Kontrol bagaimana concurrent Job di-handle
  • History limit - Otomatis cleanup old Job
  • Timezone support - Bisa run di specific timezone
  • Suspend capability - Bisa pause scheduled execution

Kenapa Kita Butuh CronJob?

CronJob dirancang untuk recurring task yang perlu run on a schedule:

  • Scheduled backup - Daily database backup, weekly full backup
  • Report generation - Daily report, monthly summary
  • Data cleanup - Remove old log, temporary file, expired data
  • Data synchronization - Sync data between system periodically
  • Health check - Periodic system health verification
  • Certificate renewal - Automated certificate management
  • Cache warming - Pre-populate cache before peak hour
  • Batch processing - Process accumulated data di specific time
  • Monitoring task - Periodic check dan alert

Tanpa CronJob, kalian perlu:

  • Manually create Job di scheduled time
  • Set up external scheduler
  • Manage Job cleanup sendiri
  • Handle timezone conversion manually

CronJob vs Job

Mari kita pahami perbedaan kunci nya:

AspekCronJobJob
ExecutionScheduled, recurringOne-time
ScheduleCron syntaxImmediate
Job creationAutomatic on scheduleManual
Use caseRecurring taskOne-time task
ManagementCreate dan manage JobRun Pod directly
CleanupAutomatic dengan history limitManual atau TTL

Contoh scenario:

  • CronJob: Menjalankan database backup setiap hari jam 2 pagi
  • Job: Menjalankan database migration once during deployment

Cron Schedule Syntax

CronJob menggunakan standard cron format dengan 5 field:

plaintext
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
│ │ │ │ │
* * * * *

Contoh Schedule Umum

Setiap menit:

plaintext
* * * * *

Setiap jam di menit 0:

plaintext
0 * * * *

Setiap hari jam 2:30 pagi:

plaintext
30 2 * * *

Setiap Senin jam 9:00 pagi:

plaintext
0 9 * * 1

Setiap 15 menit:

plaintext
*/15 * * * *

Setiap 6 jam:

plaintext
0 */6 * * *

Hari pertama setiap bulan di midnight:

plaintext
0 0 1 * *

Setiap weekday jam 6:00 sore:

plaintext
0 18 * * 1-5

Setiap Minggu jam 3:00 pagi:

plaintext
0 3 * * 0

Dua kali sehari (6 pagi dan 6 sore):

plaintext
0 6,18 * * *

Membuat CronJob

Mari kita buat basic CronJob:

Contoh 1: Basic CronJob

Buat file bernama cronjob-basic.yml:

Kubernetescronjob-basic.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: hello-cronjob
spec:
    schedule: "*/1 * * * *"
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: hello
                          image: busybox:1.36
                          command:
                              - /bin/sh
                              - -c
                              - date; echo "Hello from CronJob!"
                    restartPolicy: OnFailure

CronJob ini run setiap menit.

Apply konfigurasi:

Kubernetesbash
sudo kubectl apply -f cronjob-basic.yml

Verifikasi CronJob dibuat:

Kubernetesbash
sudo kubectl get cronjobs

Atau gunakan shorthand:

Kubernetesbash
sudo kubectl get cj

Output:

Kubernetesbash
NAME             SCHEDULE      SUSPEND   ACTIVE   LAST SCHEDULE   AGE
hello-cronjob    */1 * * * *   False     0        <none>          10s

Tunggu satu menit dan cek Job yang dibuat:

Kubernetesbash
sudo kubectl get jobs

Output:

Kubernetesbash
NAME                      COMPLETIONS   DURATION   AGE
hello-cronjob-28458640    1/1           5s         45s
hello-cronjob-28458641    1/1           4s         5s

Cek Pod:

Kubernetesbash
sudo kubectl get pods

Lihat log dari completed Pod:

Kubernetesbash
sudo kubectl logs hello-cronjob-28458640-abc12

Output:

Kubernetesbash
Sun Mar  1 10:00:00 UTC 2026
Hello from CronJob!

Concurrency Policy CronJob

Kontrol bagaimana CronJob handle overlapping execution:

Allow (Default)

Allow concurrent Job untuk run:

Kubernetescronjob-allow.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: concurrent-cronjob
spec:
    schedule: "*/1 * * * *"
    concurrencyPolicy: Allow
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: task
                          image: busybox:1.36
                          command:
                              - /bin/sh
                              - -c
                              - echo "Starting"; sleep 120; echo "Done"
                    restartPolicy: OnFailure

Behavior:

  • Multiple Job bisa run simultaneously
  • Job baru start meskipun previous Job masih running
  • Bagus untuk independent task

Forbid

Prevent concurrent Job:

Kubernetescronjob-forbid.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: sequential-cronjob
spec:
    schedule: "*/1 * * * *"
    concurrencyPolicy: Forbid
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: task
                          image: busybox:1.36
                          command:
                              - /bin/sh
                              - -c
                              - echo "Starting"; sleep 120; echo "Done"
                    restartPolicy: OnFailure

Behavior:

  • Skip Job baru jika previous Job masih running
  • Prevent overlapping execution
  • Bagus untuk task yang tidak boleh run concurrently

Replace

Replace currently running Job dengan yang baru:

Kubernetescronjob-replace.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: replace-cronjob
spec:
    schedule: "*/1 * * * *"
    concurrencyPolicy: Replace
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: task
                          image: busybox:1.36
                          command:
                              - /bin/sh
                              - -c
                              - echo "Starting"; sleep 120; echo "Done"
                    restartPolicy: OnFailure

Behavior:

  • Cancel currently running Job
  • Start Job baru di tempatnya
  • Bagus untuk task dimana latest execution paling penting

History Limit

Kontrol berapa banyak completed dan failed Job yang di-keep:

Kubernetescronjob-history.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: history-cronjob
spec:
    schedule: "*/5 * * * *"
    successfulJobsHistoryLimit: 3
    failedJobsHistoryLimit: 1
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: task
                          image: busybox:1.36
                          command: ["echo", "Task completed"]
                    restartPolicy: OnFailure

CronJob ini:

  • Keep last 3 successful Job
  • Keep last 1 failed Job
  • Otomatis delete older Job

Default value:

  • successfulJobsHistoryLimit: 3
  • failedJobsHistoryLimit: 1

Starting Deadline

Set deadline untuk starting Job:

Kubernetescronjob-deadline.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: deadline-cronjob
spec:
    schedule: "0 2 * * *"
    startingDeadlineSeconds: 3600
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: task
                          image: busybox:1.36
                          command: ["echo", "Task completed"]
                    restartPolicy: OnFailure

CronJob ini:

  • Scheduled untuk run jam 2:00 pagi
  • Harus start dalam 1 jam (3600 detik)
  • Jika missed, count sebagai failed schedule

Use case: Jika cluster down saat scheduled time, Job masih bisa start saat cluster kembali up (dalam deadline).

Suspend CronJob

Temporarily pause CronJob execution:

Kubernetescronjob-suspend.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: suspended-cronjob
spec:
    schedule: "*/1 * * * *"
    suspend: true
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: task
                          image: busybox:1.36
                          command: ["echo", "Task completed"]
                    restartPolicy: OnFailure

Dengan suspend: true, CronJob tidak akan membuat Job baru.

Suspend existing CronJob:

Kubernetesbash
sudo kubectl patch cronjob hello-cronjob -p '{"spec":{"suspend":true}}'

Resume suspended CronJob:

Kubernetesbash
sudo kubectl patch cronjob hello-cronjob -p '{"spec":{"suspend":false}}'

Timezone Support

Specify timezone untuk schedule (Kubernetes 1.25+):

Kubernetescronjob-timezone.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: timezone-cronjob
spec:
    schedule: "0 9 * * *"
    timeZone: "America/New_York"
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: task
                          image: busybox:1.36
                          command: ["echo", "Good morning!"]
                    restartPolicy: OnFailure

Ini run jam 9:00 pagi Eastern Time.

Important

Penting: Timezone support require Kubernetes 1.25 atau later. Tanpa timeZone field, schedule menggunakan controller manager's timezone (biasanya UTC).

Melihat Detail CronJob

Untuk melihat informasi detail tentang CronJob:

Kubernetesbash
sudo kubectl describe cronjob hello-cronjob

Output:

Kubernetesbash
Name:                          hello-cronjob
Namespace:                     default
Labels:                        <none>
Annotations:                   <none>
Schedule:                      */1 * * * *
Concurrency Policy:            Allow
Suspend:                       False
Successful Job History Limit:  3
Failed Job History Limit:      1
Starting Deadline Seconds:     <unset>
Selector:                      <unset>
Parallelism:                   <unset>
Completions:                   <unset>
Pod Template:
  Labels:  <none>
  Containers:
   hello:
    Image:      busybox:1.36
    Command:
      /bin/sh
      -c
      date; echo "Hello from CronJob!"
    Environment:     <none>
    Mounts:          <none>
  Volumes:           <none>
Last Schedule Time:  Sun, 01 Mar 2026 10:05:00 +0000
Active Jobs:         <none>
Events:
  Type    Reason            Age   From                Message
  ----    ------            ----  ----                -------
  Normal  SuccessfulCreate  5m    cronjob-controller  Created job hello-cronjob-28458640
  Normal  SuccessfulCreate  4m    cronjob-controller  Created job hello-cronjob-28458641
  Normal  SuccessfulCreate  3m    cronjob-controller  Created job hello-cronjob-28458642

Contoh Praktis

Contoh 1: Daily Database Backup

Kubernetesbackup-cronjob.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: database-backup
    labels:
        app: backup
        type: database
spec:
    schedule: "0 2 * * *"
    timeZone: "UTC"
    concurrencyPolicy: Forbid
    successfulJobsHistoryLimit: 7
    failedJobsHistoryLimit: 3
    jobTemplate:
        spec:
            backoffLimit: 2
            activeDeadlineSeconds: 3600
            template:
                metadata:
                    labels:
                        app: backup
                        type: database
                spec:
                    containers:
                        - name: backup
                          image: postgres:15-alpine
                          command:
                              - /bin/sh
                              - -c
                              - |
                                  BACKUP_FILE="/backup/db-backup-$(date +%Y%m%d-%H%M%S).sql"
                                  pg_dump -h $DB_HOST -U $DB_USER -d $DB_NAME > $BACKUP_FILE
                                  gzip $BACKUP_FILE
                                  echo "Backup completed: ${BACKUP_FILE}.gz"
                          env:
                              - name: DB_HOST
                                value: "postgres-service"
                              - name: DB_USER
                                valueFrom:
                                    secretKeyRef:
                                        name: db-credentials
                                        key: username
                              - name: DB_NAME
                                value: "production"
                              - name: PGPASSWORD
                                valueFrom:
                                    secretKeyRef:
                                        name: db-credentials
                                        key: password
                          volumeMounts:
                              - name: backup-storage
                                mountPath: /backup
                    volumes:
                        - name: backup-storage
                          persistentVolumeClaim:
                              claimName: backup-pvc
                    restartPolicy: OnFailure

CronJob ini:

  • Run daily jam 2:00 pagi UTC
  • Prevent concurrent backup
  • Keep 7 successful backup
  • Compress backup file
  • Store di persistent volume

Contoh 2: Hourly Log Cleanup

Kubernetescleanup-cronjob.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: log-cleanup
spec:
    schedule: "0 * * * *"
    concurrencyPolicy: Forbid
    successfulJobsHistoryLimit: 3
    failedJobsHistoryLimit: 1
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: cleanup
                          image: busybox:1.36
                          command:
                              - /bin/sh
                              - -c
                              - |
                                  echo "Starting log cleanup..."
                                  find /logs -name "*.log" -mtime +7 -delete
                                  echo "Cleanup completed"
                          volumeMounts:
                              - name: logs
                                mountPath: /logs
                    volumes:
                        - name: logs
                          hostPath:
                              path: /var/log/app
                    restartPolicy: OnFailure

CronJob ini:

  • Run setiap jam
  • Delete log lebih dari 7 hari
  • Prevent concurrent cleanup operation

Contoh 3: Weekly Report Generation

Kubernetesreport-cronjob.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: weekly-report
spec:
    schedule: "0 8 * * 1"
    timeZone: "America/New_York"
    concurrencyPolicy: Forbid
    successfulJobsHistoryLimit: 4
    failedJobsHistoryLimit: 2
    jobTemplate:
        spec:
            backoffLimit: 1
            template:
                spec:
                    containers:
                        - name: report-generator
                          image: python:3.11-slim
                          command:
                              - python
                              - -c
                              - |
                                  import datetime
                                  print("Generating weekly report...")
                                  print(f"Report date: {datetime.datetime.now()}")
                                  # Generate report logic here
                                  print("Report generated successfully")
                          env:
                              - name: DATABASE_URL
                                valueFrom:
                                    secretKeyRef:
                                        name: app-secrets
                                        key: database-url
                              - name: SMTP_HOST
                                value: "smtp.example.com"
                          resources:
                              requests:
                                  memory: "512Mi"
                                  cpu: "500m"
                              limits:
                                  memory: "1Gi"
                                  cpu: "1000m"
                    restartPolicy: OnFailure

CronJob ini:

  • Run setiap Senin jam 8:00 pagi Eastern Time
  • Generate weekly report
  • Set resource limit untuk report generation

Contoh 4: Cache Warming

Kubernetescache-warming-cronjob.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: cache-warmer
spec:
    schedule: "0 6 * * *"
    concurrencyPolicy: Replace
    successfulJobsHistoryLimit: 2
    failedJobsHistoryLimit: 1
    jobTemplate:
        spec:
            activeDeadlineSeconds: 1800
            template:
                spec:
                    containers:
                        - name: warmer
                          image: curlimages/curl:latest
                          command:
                              - /bin/sh
                              - -c
                              - |
                                  echo "Warming cache..."
                                  curl -s http://api-service/api/warm-cache
                                  echo "Cache warmed successfully"
                    restartPolicy: OnFailure

CronJob ini:

  • Run daily jam 6:00 pagi
  • Warm application cache sebelum peak hour
  • Replace running Job jika new schedule arrive

Contoh 5: Certificate Check

Kubernetescert-check-cronjob.yml
apiVersion: batch/v1
kind: CronJob
metadata:
    name: certificate-checker
spec:
    schedule: "0 0 * * *"
    concurrencyPolicy: Forbid
    successfulJobsHistoryLimit: 7
    failedJobsHistoryLimit: 3
    jobTemplate:
        spec:
            template:
                spec:
                    containers:
                        - name: checker
                          image: alpine:latest
                          command:
                              - /bin/sh
                              - -c
                              - |
                                  apk add --no-cache openssl
                                  echo "Checking certificates..."
                                  echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -noout -dates
                                  echo "Certificate check completed"
                    restartPolicy: OnFailure

CronJob ini:

  • Run daily di midnight
  • Check SSL certificate expiration
  • Keep 7 hari history

Monitoring CronJob

Cek Status CronJob

Kubernetesbash
sudo kubectl get cronjobs

Lihat Detail CronJob

Kubernetesbash
sudo kubectl describe cronjob hello-cronjob

List Job yang Dibuat oleh CronJob

Kubernetesbash
sudo kubectl get jobs --selector=cronjob=hello-cronjob

Watch CronJob Activity

Kubernetesbash
sudo kubectl get cronjobs -w

Cek Last Execution Time

Kubernetesbash
sudo kubectl get cronjob hello-cronjob -o jsonpath='{.status.lastScheduleTime}'

Lihat CronJob Event

Kubernetesbash
sudo kubectl get events --sort-by='.lastTimestamp' | grep CronJob

Kesalahan Umum dan Pitfall

Kesalahan 1: Incorrect Cron Syntax

Problem: Menggunakan wrong cron format atau invalid value.

Solusi: Validate cron syntax sebelum apply:

bash
# Gunakan online cron validator atau test locally
# Benar: */5 * * * * (setiap 5 menit)
# Salah: 5 * * * * (di menit 5 setiap jam)

Kesalahan 2: Tidak Set Concurrency Policy

Problem: Multiple Job running concurrently saat seharusnya tidak.

Solusi: Set appropriate concurrencyPolicy:

Kubernetesyml
spec:
    concurrencyPolicy: Forbid  # Untuk task yang tidak boleh overlap

Kesalahan 3: Tidak Ada History Limit

Problem: Accumulation dari old Job consuming resource.

Solusi: Set history limit:

Kubernetesyml
spec:
    successfulJobsHistoryLimit: 3
    failedJobsHistoryLimit: 1

Kesalahan 4: Ignore Timezone

Problem: Job run di wrong time karena timezone confusion.

Solusi: Explicitly set timezone (Kubernetes 1.25+):

Kubernetesyml
spec:
    timeZone: "America/New_York"

Kesalahan 5: Tidak Ada Starting Deadline

Problem: Missed schedule pile up saat cluster recover.

Solusi: Set startingDeadlineSeconds:

Kubernetesyml
spec:
    startingDeadlineSeconds: 3600

Kesalahan 6: Tidak Set Resource Limit

Problem: CronJob Pod consume excessive resource.

Solusi: Selalu set resource limit di Job template:

Kubernetesyml
resources:
    requests:
        memory: "256Mi"
        cpu: "250m"
    limits:
        memory: "512Mi"
        cpu: "500m"

Best Practice

Gunakan Appropriate Concurrency Policy

Pilih berdasarkan task requirement:

Kubernetesyml
spec:
    concurrencyPolicy: Forbid  # Untuk sequential task
    # concurrencyPolicy: Allow  # Untuk independent task
    # concurrencyPolicy: Replace  # Untuk latest-only task

Set History Limit

Prevent Job accumulation:

Kubernetesyml
spec:
    successfulJobsHistoryLimit: 3
    failedJobsHistoryLimit: 1

Configure Starting Deadline

Handle missed schedule gracefully:

Kubernetesyml
spec:
    startingDeadlineSeconds: 3600

Gunakan Timezone Field

Make schedule explicit (Kubernetes 1.25+):

Kubernetesyml
spec:
    timeZone: "UTC"

Set Job Deadline

Prevent Job dari running terlalu lama:

Kubernetesyml
jobTemplate:
    spec:
        activeDeadlineSeconds: 3600

Tambahkan Meaningful Label

Organize dan filter CronJob:

Kubernetesyml
metadata:
    labels:
        app: backup
        type: database
        schedule: daily

Gunakan Secret untuk Credential

Jangan hardcode sensitive data:

Kubernetesyml
env:
    - name: PASSWORD
      valueFrom:
          secretKeyRef:
              name: credentials
              key: password

Set Resource Limit

Prevent resource exhaustion:

Kubernetesyml
resources:
    requests:
        memory: "256Mi"
        cpu: "250m"
    limits:
        memory: "512Mi"
        cpu: "500m"

Test Schedule Sebelum Production

Verify cron syntax dan timing:

Kubernetesbash
# Test dengan frequent schedule dulu
schedule: "*/1 * * * *"  # Setiap menit untuk testing
 
# Kemudian ubah ke production schedule
schedule: "0 2 * * *"  # Daily jam 2 pagi

Monitor CronJob Execution

Set up alert untuk failed Job:

Kubernetesbash
# Check untuk failed Job
sudo kubectl get jobs --field-selector status.successful=0

Menghapus CronJob

Hapus CronJob dan Job nya

Kubernetesbash
sudo kubectl delete cronjob hello-cronjob

Ini menghapus CronJob dan semua Job yang dibuatnya.

Hapus CronJob tapi Keep Job

Kubernetesbash
sudo kubectl delete cronjob hello-cronjob --cascade=orphan

Ini hanya menghapus CronJob, membiarkan Job running.

Troubleshooting CronJob

CronJob Tidak Membuat Job

Cek apakah CronJob suspended:

Kubernetesbash
sudo kubectl get cronjob hello-cronjob -o jsonpath='{.spec.suspend}'

Cek schedule syntax:

Kubernetesbash
sudo kubectl describe cronjob hello-cronjob

Job Fail Repeatedly

Cek Job log:

Kubernetesbash
# Get latest Job
JOB=$(kubectl get jobs --sort-by=.metadata.creationTimestamp | tail -1 | awk '{print $1}')
 
# Get Pod dari Job
POD=$(kubectl get pods --selector=job-name=$JOB -o jsonpath='{.items[0].metadata.name}')
 
# View log
sudo kubectl logs $POD

Terlalu Banyak Old Job

Adjust history limit:

Kubernetesbash
sudo kubectl patch cronjob hello-cronjob -p '{"spec":{"successfulJobsHistoryLimit":3}}'

Penutup

Pada episode 15 ini, kita telah membahas CronJob di Kubernetes secara mendalam. Kita sudah belajar apa itu CronJob, bagaimana dia build on Job untuk menyediakan scheduled execution, dan cara menggunakannya untuk recurring task.

Key takeaway:

  • CronJob membuat Job berdasarkan time-based schedule menggunakan cron syntax
  • Menggunakan standard cron format dengan 5 field (minute, hour, day, month, weekday)
  • Tiga concurrency policy: Allow, Forbid, Replace
  • History limit otomatis cleanup old Job
  • Starting deadline handle missed schedule gracefully
  • Timezone support available di Kubernetes 1.25+
  • Bisa suspend CronJob untuk pause execution
  • Perfect untuk backup, report, cleanup, dan recurring maintenance
  • Selalu set resource limit dan history limit
  • Gunakan appropriate concurrency policy berdasarkan task requirement

CronJob essential untuk automating recurring task di Kubernetes. Dengan memahami CronJob, kalian bisa effectively schedule backup, generate report, cleanup resource, dan automate maintenance task tanpa external scheduler.

Bagaimana, makin jelas kan tentang CronJob di Kubernetes? Di episode 16 berikutnya, kita akan membahas Node Selector, mekanisme simple untuk kontrol Pod placement di specific node berdasarkan label. Jadi, pastikan tetap semangat belajar dan nantikan episode selanjutnya!

Catatan

Untuk kalian yang ingin lanjut ke episode berikutnya, bisa click thumbnail episode 16 di bawah ini

Episode 16Episode 16

Related Posts