Config - Resource Requirements Flashcards

1
Q

What happens to the resources on a node, when a pod gets deployed on it?

A
  • ## the pod consumes part of the resources that are available to the node
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Who decides where pods are deployed? On what is part of this consideration?

A
  • kube-scheduler decides this
  • considers the current resource utilization of the node
  • identifies the best node for pod deployment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens if nodes have not sufficient resources available?

A
  • kube-scheduler avoids these nodes
  • uses a node with sufficient resources
  • if there are no nodes with sufficient resources available, it holds back the pod (Status: Pending)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the amount of needed CPU/Memory/… called for a pod?

A

Resource Request

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

How do we add a Resource Request to a pod?

A

pod-yaml
~~~
apiVersion: v1
kind: Pod
metadata:
name:
labels:
spec:
containers:
- name:
image:
ports:
resources:
requests:
memory: “4Gi”
cpu: 2
~~~

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

What are valid cpu values for resource requests?

A

0.1 - full int value
0.1 equals 100m
lowest value is 1m
1 count of cpu is equivalent of vCPU (AWS, CGP, Azure, …)

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

What are valid memory values for resource requests?

A

256 Mi
268M
1G

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

When specifying resouce requests for memory, what is the difference between G/M/K and Gi/Mi/Ki

A

G= Gigabytes = 1,000,000,000 bytes

Gi = Gigibytes = 1,074,741,824 bytes

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

What are the default limitations for a node what resources it can consume on a node?

A

By default no limit

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

How can we limit, what a pod should be allowed to consume on a node?

A

by setting/using Resource Limits
in pod-yaml, under resources
~~~
spec:
resources:
requests:
cpu: 2
memory: “1Gi”
limits:
cpu: 3
memory: “2Gi”
~~~

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

What happens, when a pod tries to exceed the set limit of resource consumption?

A
  • cpu: consumption gets throttled not to exceed the limit
  • memory: container can consume more memory than its limit
  • if this happens constantly, the pod gets terminated with Out Of Memory Error (OOM)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an implication of the default Kubernetes behavior looking at resource limits and requests

A
  • by default no limits or requests
  • pods can suffocate each other by rising resource utiliation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What happens if we only set limits for a pod, but no resource requests?

A
  • limits are assumed to be also the request value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do we let one pod consume cpu resources, higher than its limit, as long as the other pod on the node are not using all thats left?

A

Only setting requests, no limits
Usually most ideal set-up

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

How do we ensure that every pod has some limit set?

A

By using LimitRanges
Help you define default values to be set for pods.
Set at namespace level
Is an object, created by yaml

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

How does a Limit Range yaml look like?

A
apiVersion: v1
kind: LimitRange
metadata:
 name: cpu-resource-constraint
spec:
 limits:
  - default:
      cpu: 500m
		defaultRequest:
		  cpu: 500m
		max:
		  cpu: "1"
		min: 
		  cpu: 100m
		type: container

Default and max refer to the limit

17
Q

When are the limits, set by a limit range, enforced?

A

When a pod gets created

18
Q

How can we limit the total amount of resources that can be consumed by applications deployed in a Kubernetes cluster?

A

yes: Resource Quota, at namespace level

I.E. all pods together should consume max this amount of memory

19
Q

What is a resource quota and how does it look?

A
  • namespace level object
  • limits the total amount of resources used by all pods
    own yaml:
apiVersion: v1
kind: ResourceQuota
metadata: 
 name: my-resource-quota
spec:
  hard:
	  requests.cpu: 4
		requests.memory: 4Gi
		limits.cpu: 10
		limits:memory: 10Gi