Workloads Flashcards

1
Q

What are workloads, what are they used for?

A

A Workload is a resource manages pods automatically, without a worload if a Node fails, all Pods on that Node without a workload will stop working until a new Pod is created manually.

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

What types of Workloads are there?

A

DeploymentSet, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob

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

What is a Deployment?

A

Deployment is good for stateless application workload and initiate ReplicaSets to ensure there is always a number of pods running and also allows for the easy update of thoose pods. They also manage deployments and are able to rollback as well.

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

What is a ReplicaSet?

A

ReplicaSets ensure a workload keeps running with the desired number of pods. It also has the capability of scaling the replicas up or down.

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

What is a StatefulSet?

A

StatefulSet are good for applications that do require a record of state this is done bby using a PersistentVolume resource

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

What is a DaemonSet?

A

DaemonSet defines pods that provide node facilities a pod will be set per node that matches the specification on the DaemonSet

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

What is a Job and CronJob?

A

A Job defines tasks that run to completion, CronJobs will recurr on a schedule.

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

What are the issues with Pods, what resources help solving these issues?

A

Running an application in a single pod has 2 issues, first it represents a single point of failure and second pods lack failure tolerance, they won’t restart by themselves, to solve this ReplicaSets and DeploymentSets are used.

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

Will this manifest for a Deployment work?
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-cache
labels:
app: app-cache
spec:
replicas: 4
selector:
matchLabels:
app: app-cache
template:
metadata:
labels:
app: app-data
spec:
containers:
- name: memcached
image: memcached:1.6.8

A

No it will not, labels on Delpoyment manifests need to be the same both on the selector as well as on the template. So the app label under spec.selector.matchLabels needs to match the label under spec.template.metadata.labels

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

How would you update the image of a deployment running an nginx image “nginx:1.16.0” to image “nginx:1.17.0”?

A

kubectl set image deployment a-deploy nginx=nginx:1.17.0 –record

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

How would you check the updates that have been done for a particular deployment “a-deploy”?

A

kubectl rollout history deployment a-deploy

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

How would you check for the status of a rollout for deployment a-deploy?

A

kubectl rollout status deployment a-deploy

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

How would you scale deployment “a-deploy” to have 5 replicas

A

kubectl scale deployment a-deploy –replicas 5

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

How would you set a hpa to autoscale a-deploy between 3 and 5 replicas with a target cpu percentage of 80

A

kubectl autoscale deployment a-deploy –cpu-percent 80 –min 3 –max 5

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

Whould a deployment with this container template be able to use hpa?
template:
spec:
containers:
- name: memcached
image: nginx

A

No it wouldn’t, the container must define resource requests for hpa to be appliable

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