DEV Community

Cover image for Kubernetes Patterns - The Batch Job Pattern
Ahmed Atef
Ahmed Atef

Posted on • Originally published at magalix.com

Kubernetes Patterns - The Batch Job Pattern

Pods Common Pattern

A Pod may host one or more containers in which all of them are treated as one unit. There are several ways available to create Pods. For example:

Naked Pods: These are the Pods that you can create directly through a definition file. In general, this is not a recommended practice because a controller does not manage the created Pods. If the Pod is terminated or the node crashed, it will not restart or reschedule on a different node.
ReplicaSet: This controller is suitable for Pods that need to run continuously. It can restart when it fails. For example, web servers and APIs.
DaemonSets: This can be used to run Pods continuously. Also, it ensures that they run on every node of the cluster. A typical scenario for using DaemonSets is when you want to collect logs from the cluster nodes and send them to a log aggregator such as ElasticSearch.
As you can see, the typical pattern here is trying to have the Pod running at all times. This pattern is a common one: you always want your service to continue responding to requests. However, in some cases, you need the container to run once and then get terminated.

For More infomration about the Batch Job see: https://www.magalix.com/blog/kubernetes-patterns-the-batch-job-pattern

Top comments (0)