Kubernetes Resource Lecture Flashcards

(51 cards)

1
Q

In Kubernetes, what resources does each node provide for pods?

A

CPU and memory.

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

What does each pod require in order to run on a node?

A

A specified amount of CPU and memory resources.

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

Which Kubernetes component decides which node a pod is placed on?

A

The Kubernetes Scheduler.

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

What does the Kubernetes scheduler consider when placing a pod on a node?

A

The pod’s resource requests and the available resources on each node.

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

What happens if no node has sufficient resources to satisfy a pod’s request?

A

The pod remains in the Pending state and is not scheduled.

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

In a Pending pod, what might you see in kubectl describe pod if there aren’t enough CPU resources?

A

An event indicating insufficient CPU (or similar resource-related message).

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

In Kubernetes, what is a resource request for a container?

A

The minimum amount of CPU or memory that a container asks for and is guaranteed.

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

Where do you define resource requests in a pod manifest?

A

Under spec.containers[].resources.requests for each container.

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

How does the scheduler use resource requests?

A

It uses them to find a node with enough free capacity to run the pod.

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

What is the effect of setting a CPU request for a container?

A

The container is guaranteed at least that amount of CPU when there is contention.

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

What is the effect of setting a memory request for a container?

A

The container is guaranteed at least that amount of memory when there is contention.

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

In Kubernetes, what does 1 CPU represent?

A

Roughly 1 vCPU/core/hyperthread (e.g., 1 vCPU in AWS or 1 core in GCP/Azure).

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

How can you represent 0.1 CPU using milliCPU units?

A

As 100m (100 millicpu).

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

What is the smallest CPU value you can request in Kubernetes?

A

1m (1 millicpu).

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

Can you request non-integer CPU amounts like 0.3 CPU?

A

Yes, for example 0.3 CPU ≈ 300m.

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

What is the difference between G and Gi when specifying memory?

A

G is gigabyte (GB, base 1000); Gi is gibibyte (GiB, base 1024).

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

What does 256Mi represent?

A

256 mebibytes (binary unit, base 1024).

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

Which suffix family is base-10 for memory units in Kubernetes?

A

K, M, G (e.g., MB, GB).

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

Which suffix family is base-2 for memory units in Kubernetes?

A

Ki, Mi, Gi (e.g., MiB, GiB).

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

In Kubernetes, what is a resource limit for a container?

A

The maximum amount of CPU or memory that a container is allowed to use.

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

Where do you set resource limits in a pod manifest?

A

Under spec.containers[].resources.limits.

22
Q

Are resource requests and limits applied per pod or per container?

A

Per container; each container has its own requests and limits.

23
Q

What happens if a container tries to use more CPU than its limit?

A

The CPU usage is throttled so it cannot exceed its CPU limit.

24
Q

Does exceeding CPU limits by itself cause a container to be killed?

A

No, CPU overuse is throttled rather than killing the container.

25
What happens if a container uses more memory than its limit?
It can be killed by the OOM (Out Of Memory) killer (OOMKilled).
26
Why can CPU usage be throttled but memory usage cannot?
CPU can be scheduled and limited over time; memory, once allocated, can only be reclaimed by freeing it, often by killing the pod.
27
By default, does Kubernetes set resource requests for pods?
No, by default there are no resource requests set.
28
By default, does Kubernetes set resource limits for pods?
No, by default there are no resource limits set.
29
What is the risk of running pods with no resource requests and no limits?
One pod can consume all CPU or memory on a node, starving other pods and system processes.
30
If two pods have no CPU requests and no limits, how is CPU shared?
Unfairly; one pod can hog all CPU while the other gets very little.
31
If CPU limits are set but requests are not, what does Kubernetes do?
It automatically sets CPU requests equal to the CPU limits.
32
In the CPU scenario where only limits are set, what does each pod effectively get?
Each pod is guaranteed CPU equal to its limit and cannot exceed that limit.
33
In the CPU scenario where requests=1 and limits=3, what does that mean for a pod?
The pod is guaranteed 1 vCPU and can use up to 3 vCPU but no more.
34
Why might “requests and limits both set” for CPU be suboptimal?
A pod that could use more CPU is capped at its limit even if the node has spare CPU and other pods are idle.
35
Why is “CPU requests set, but no CPU limits” often considered ideal?
Each pod has a guaranteed minimum CPU, and pods can use extra CPU if it’s available instead of being capped.
36
If two pods have no memory requests and no limits, what can happen?
One pod can consume all memory, causing the other to be starved or killed.
37
If memory limits are set but requests are not, what does Kubernetes do?
It automatically sets memory requests equal to the memory limits.
38
In the memory scenario with requests=1Gi and limits=3Gi, what happens if a pod exceeds 3Gi?
It can be OOMKilled for exceeding its memory limit.
39
What is the main risk of setting memory requests but no memory limits?
A pod can grow to use all available memory, causing OOMKills and node instability.
40
What is a LimitRange in Kubernetes?
A namespace-scoped object that defines default requests/limits and min/max constraints for containers in pods.
41
At what scope is a LimitRange applied?
At the namespace level.
42
What can a LimitRange configure for CPU or memory?
Default limits, default requests, max limits, and min requests.
43
When does a LimitRange take effect on pods?
Only for new pods created or updated after the LimitRange is applied or changed.
44
Does changing a LimitRange affect existing pods immediately?
No, existing pods are not changed; only new pods are affected.
45
What is a ResourceQuota in Kubernetes?
A namespace-scoped object that sets hard limits on the total resource usage in that namespace.
46
At what scope is a ResourceQuota applied?
At the namespace level.
47
What can a ResourceQuota limit with respect to CPU and memory?
Total requested CPU/memory and total CPU/memory limits for all pods in a namespace.
48
Why would you use a ResourceQuota?
To prevent one namespace or team from consuming too many cluster resources and to enforce fair multi-tenant usage.
49
What is a common recommended pattern for CPU configuration in Kubernetes?
Set CPU requests for all containers and optionally avoid CPU limits to allow bursting when capacity is available.
50
What is a key concern when skipping memory limits for containers?
A misbehaving pod can consume all memory and cause OOMKills and node instability.
51
Why is it important that all pods have some CPU or memory requests set, especially if you skip limits?
Requests guarantee minimum resources; without them, any pod with no request can be starved by pods that consume all available CPU or memory.