Is Pod and Job resource the same ?
apiVersion: v1
kind: Pod
metadata:
name: ""
labels:
or
apiVersion: v1
kind: Job
metadata:
name: ""
labels:
The Job
will still create a pod I think. Just wondering when do I use one instead of the other.
To create batch transactions, Kubernetes provides two workload resources: the Job object and the CronJob object. A Job object creates one or more Pods and attempts to retry the execution until a specified number of them terminate successfully. CronObjects, such as crontab, run on a cron schedule.
simply put: deployments are used for services that are expected to be up and running continuously. think webservers, databases, etc. jobs/cronjobs are meant for tasks that are meant to be run and exit after they have finished. think: database backups, etcs.
A pod is the smallest execution unit in Kubernetes. A pod encapsulates one or more applications. Pods are ephemeral by nature, if a pod (or the node it executes on) fails, Kubernetes can automatically create a new replica of that pod to continue operations.
Pod is basic unit to express a runnable process on Kubernetes.
Job is a higher level abstraction that uses pods to run a completable task.
You might be thinking of using a pod with restartPolicy: Never
to run a completable task. But in the event of node failure, pod on that node managed by Job are rescheduled to other node but an unmanaged pod is not.
Job also has extra features like completions
and parallelism
using which you can run multiple instances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With