Your container application is designed not only for daemon processes such as nginx, but also for some batch Jobs which eventually exit when the task is complete. Kubernetes supports this scenario; you can submit a container as a Job and Kubernetes will dispatch to an appropriate node and execute your Job.
In this recipe, we will discuss two new features: Jobs and CronJob. These two features can make another usage of Pods to utilize your resources.
Since Kubernetes version 1.2, Kubernetes Jobs has been introduced as a stable feature (apiVersion: batch/v1
). In addition, CronJob is a beta feature (apiVersion: batch/v1beta1
) as of Kubernetes version 1.10.
Both work well on minikube, which was introduced at Chapter 12, Building Your Own Kubernetes Cluster. Therefore, this recipe will use minikube version 0.24.1.