POD Design - Jobs and Cron Jobs Flashcards

1
Q

What types of workloads do exist for instance?

A
  • application
  • web
  • database
  • reporting
  • batch-processing
  • analytics
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How are types of workloades abstractly different to each other?

A
  • some need to keep on working
  • some finish after a certain task / set of tasks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the default behavior of Kubernetes in terms of pod lifecycle?

A

Wants to keep the pods running.
If a pods is in Status Completed it gets restarted, as often till a certain threshold is reached

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What specifies the Restart behavior of Kubernetes pods?

A

restartPolicy - by default set to Always

spec:
 containers:
  - image
    name
	  command
	restartPolicy: Always
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are valid options for restartPolicy of a pod?

A
  • Always
  • Never
  • OnFailure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is special about i.e batch-workloads?

A
  • parallel working through a set of tasks
  • we need a manager that makes sure, the work is done successfully
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between a ReplicaSet and Jobs?

A
  • ReplicaSet wants to keep the pods up running all the time
  • Jobs keep pods running till completion
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do we create a job?

A

job-definition.yaml:
~~~
apiVersion: batch/v1
kind: Job
metadata:
name: math-add-job
spec:
completions: 3
template:
spec:
containers:
- name:
image:
command:
restartPolicy: Never
~~~
Under template has a pod definition spec

kubectl create -f
kubectl get jobs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can you see the standard output of container?

A

kubectl logs pod-name pot.container-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the ‘completed’ addition change for a job?

A
  • specified the amount of pods needed to be in Status Completed to see job as completed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How are pods in jobs by default created?

A

one after the other

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can we specify that a jobs runs pods in parallel?

A
apiVersion: batch/v1
kind: Job
metadata:
 name: math-add-job
spec:
 completions: 3
 parallelism: 3
 template:
   spec:
	   containers:
		   - name: 
		     image:
				 command:
		 restartPolicy: Never	
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are CronJobs?

A
  • a job that can be scheduled and run periodically
  • for instance a job that creates a report and sends an email
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How does a cronjob yaml look like?

A
apiVersion: batch/v1
kind: CronJob
metadata:
 name: reporting-cronjob
spec:
  schedule "*/1 * * * *"
	jobTemplate:
	  spec:
		  completions: 3
			parallelism: 3
			template:
			  spec:
				  containers:
					  - image: reporting-tool
					    name: reporting-tool
					restartingPolicy: Never
	  
 
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How form has the schedule spec of a CronJob?

A
      • minute
      • hour
      • day of the month
      • month
  1. day of the week
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How you specify the amount of fails after which a job should stop?

A

with backoffLimit under job-spec:

17
Q
A