outcoldman
outcoldman Denis Gladkikh

Kubernetes: Cron Jobs

kubernetes, k8s, cron jobs, and kubeadm

Cron jobs is one of my favorite feature in Kubernetes. I use them for backups, data retention, clean ups and some monitoring as well.

Cron Jobs feature is still in alpha. It is not enabled by default in Kubernetes 1.6 (and possible in 1.7 as well).

If you have Kubernetes setup by kubeadm, just find the file

/etc/kubernetes/manifests/kube-apiserver.yaml

Add a command argument to this Pod definition

--runtime-config=batch/v2alpha1=true

After that restart kubelet.service (if on ubuntu)

sudo systemctl restart kubelet.service

Few caveats about Cron Jobs:

kubectl delete pod -l job-name=<job_name>

Have feedback or questions? Looking for consultation?

My expertise: MongoDB, ElasticSearch, Splunk, and other databases. Docker, Kubernetes. Logging, Metrics. Performance, memory leaks.

Send me an email to public@denis.gladkikh.email.

The content on this site represents my own personal opinions and thoughts at the time of posting.

Content licensed under the Creative Commons CC BY 4.0.