Save 37% off PRO during our Black Friday Sale! »

DevOpsDays Columbus 2018: Kubernetes Cron Jobs

0438ae60cde4c7add6f9da48f28c15cc?s=47 Chris Short
September 19, 2018

DevOpsDays Columbus 2018: Kubernetes Cron Jobs

I worked for a large company with several hundred cron jobs running on two systems. Managing these jobs was cumbersome. Resource use during peak times brought things to a halt. Imagine what it was like when if systems were down! In this talk, we discuss Kubernetes’ killer feature: Cron Jobs.


Chris Short

September 19, 2018


  1. Chris Short Red Hat DevOpsDays Columbus Kubernetes Cron Jobs: Dreams

    Really Do Come True
  2. @ChrisShort 99999 Crons on the Wall 31 different daily

    newspapers Hundreds of cron jobs to run One RHEL 3 server running them The top of the hour was a nightmare sometimes No idea what broke when a cron failed
  3. @ChrisShort

  4. @ChrisShort Kubernetes Kubernetes is an open-source system for automating

    deployment, scaling, and management of containerized applications.
  5. Pods Pods are the smallest deployable units of computing that

    can be created and managed in Kubernetes. A Pod is a group of one or more containers (such as Docker containers) with shared storage/network and a specification for how to run the containers. @ChrisShort
  6. Jobs "A job creates one or more pods and ensures

    that a specified number of them successfully terminate. As pods successfully complete, the job tracks the successful completions. When a specified number of successful completions is reached, the job itself is complete." /jobs-run-to-completion/ @ChrisShort
  7. CronJob A Cron Job creates Jobs on a time-based schedule.

    One CronJob object is like one line of a crontab (cron table) file. It runs a job periodically on a given schedule, written in Cron format. /cron-jobs/ @ChrisShort
  8. @ChrisShort

  9. Use Case My newsletter, DevOps’ish, is a static site generated

    with Hugo and run on Netlify I can write the newsletter set to a date in the future Hugo won't build page until date Netlify provides a build hook that will trigger builds when called. Calling the build hook URL via curl is a way to implement scheduled posts with Hugo on Netlify. @ChrisShort
  10. Let's Build a Kubernetes CronJob @ChrisShort (with a private

    registry because I'm a masochist)
  11. @ChrisShort

  12. @ChrisShort

  13. @ChrisShort

  14. @ChrisShort

  15. @ChrisShort

  16. @ChrisShort

  17. @ChrisShort

  18. Conclusion Built a Docker container Pushed the image to a

    private registry Configured Kubernetes to use the private registry Created secret to store the build hook URL Created the CronJob
  19. References Everything but the secret The Children's Illustrated Guide to

    Kubernetes What is a Job? | Kubernetes CronJob | Kubernetes Secret | Kubernetes Kubernetes: Cron Jobs chrisshort/k8s-cron-job-demo Google Cloud Registry (GCR) with external Kubernetes
  20. @ChrisShort