Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a Pod and a Job resources in k8s?

Tags:

kubernetes

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.

like image 601
alltej Avatar asked Jan 12 '20 16:01

alltej


People also ask

What is job resource in Kubernetes?

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.

What is difference between job and deployment in Kubernetes?

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.

What is a pod in k8s?

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.


Video Answer


1 Answers

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.

like image 172
Shashank V Avatar answered Sep 18 '22 08:09

Shashank V