Pod Design Flashcards

1
Q

What is the purpose of a label?

A

Labels can be used to organize and to select subsets of objects. Labels are key/value pairs that are attached to objects, such as pods.

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

What is the purpose of a selector?

A

Via a label selector, the client/user can identify a set of objects. They allow kubernetes objects to be filtered by their label.

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

In a Pod definition, how are labels applied?

A

metadata: labels: key1: value1 key2: value2

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

What is the imperative command to select a pod with a label? (e.g. label foo with value bar)

A

kubectl get po --selector foo=bar

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

In a ReplicaSet definition, how are the pods to be managed by the ReplicaSet selected? (e.g. pods with label foo with value bar)

A

spec: selector: matchLabels: foo: bar

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

In a Service definition, how are the pods to be exposed by the Service selected? (e.g. pods with label foo and value bar)

A

spec: selector: foo: bar

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

What is the purpose of annotations?

A

You can use Kubernetes annotations to attach arbitrary non-identifying metadata to objects

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

In definition files, how are annotations applied to Kubernetes objects? (e.g. an annotation with key foo and value bar)

A

metadata: annotations: foo: bar

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

What is the imperative command for determining the status of a rollout? (e.g. for deployment named dep1)

A

kubectl rollout status deployment/dep1

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

What is the imperative command for finding the history of a rollout? (e.g. for a deployment named dep1)

A

kubectl rollout history deployment/dep1

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

What are the types of deployment strategy?

A
  • recreate (all are destroyed before new are created)
  • rolling (objects are destroyed and created one at a time)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the default deployment strategy?

A

rolling

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

What is the imperative command for changing the image of a single container deployment? (e.g. deployment named dep1 with an nginx image being updated to nginx:1.9.1)

A

kubectl set image deployment/dep1 nginx=nginx:1.9.1

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

What is the imperative command for rolling back a deployment? (e.g. deployment named dep1)

A

kubectl rollout undo deployment/dep1

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

What is the imperative command for getting the history of a particular rollout revision? (e.g. for the second revision of a deployment named dep1)

A

kubectl rollout history deployment/dep1 --revision=2

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

What is the purpose of a job?

A

A Job creates one or more Pods and ensures that a specified number of them successfully terminate. They typically carry out a specific task and then finish.

17
Q

Why is a Pod (with default restart policy value) not suitable for a one-off task?

A

A one-off task will eventually exit and the Pod will move into a completed state. Kubernetes will attempt to restart a pod once it has completed. Restarting, and re-undertaking the task, is not desired.

18
Q

In the Pod definition, how is a OnFailure restart policy applied?

A

spec: restartPolicy: OnFailure

19
Q

What are different types of restart policy?

A
  • Always
  • Never
  • OnFailure
20
Q

What is the apiVersion of a Job?

A

batch/v1

21
Q

What is the imperative command to get a list of jobs

A

kubectl get jobs

22
Q

How do you retrieve the output of a job? (e.g. for a job named job1)

A

kubectl logs job1

23
Q

In the Job definition, how are multiple pods run? (e.g. run the pod 3 times successfully)

A

spec: completions: 3

24
Q

In the Job definition, how can jobs be run in parallel? (e.g. run 3 pods in parallel)

A

spec: parallelism: 3

25
Q

What is the purpose of a CronJob?

A

A CronJob creates Jobs on a repeating schedule.

26
Q

What is the apiVersion of a CronJob?

A

batch/v1beta

27
Q

What are the two required spec properties of a CronJob?

A

spec: schedule: "" jobTemplate: {}

28
Q

What are the five properties of the CronJob schedule (in order)?

A
  • minute (0 - 59)
  • hour (0 - 23)
  • day of the month (1 - 31)
  • month (1 - 12)
  • day of the week (0 - 6). Sunday to Saturday
29
Q

What is the imperative command to list all the CronJobs?

A

kubectl get cronjobs