Chapter 4 Quiz 4.3 answer appears to be indeterminate
Given the question:
If a Pod tries to use more memory than the node has, it will be evicted. True or False?
the claimed correct answer is
True
but I could not reproduce this effect.
Taking the stress.yaml I ended up with after the exercise, and changing the container resources and args to achieve the described behaviour on my 2-core 8Gi AWS instance, I get
containers:
- image: vish/stress
imagePullPolicy: Always
name: stressmeout
resources:
limits:
cpu: "3"
memory: "16Gi"
requests:
cpu: "0.5"
memory: "4Gi"
args:
- -cpus
- "2"
- -mem-total
- "16Gi"
- -mem-alloc-size
- "500Mi"
- -mem-alloc-sleep
- "1s"
Deploying this, the container is continuously dying due to system-local OOM, but the pod is never evicted, i.e. it does not go into the Failed state. It does eventually go into CrashLoopBackOff.
Reading the docs, the documented answer here appears to be "Maybe", because it seems to depend if kubelet gets there before the OOM killer. In my case it never happened due to the size of my mem-alloc-size, there was never a point where the kubelet had memory pressure, as the OOMKiller killed it.
Updating that Deployment with -mem-alloc-size of 50Mi still didn't trigger it. I suspect a longer sleep between allocations would, i.e. hanging around inside the eviction threshold for more than 10 seconds, but that'll take a while to run.
Given the content of the chapter, I would have expected the question to be about the requests or limits being greater than the node has, rather than the runtime usage, since that wasn't really touched upon at all in the exercises.
Answers
-
@TBBle the value I derived from the exercise was fiddling around with the sizing and repeating that over and over gaining a certain confidence in debugging
i see your point…. I just got something else out of the exercise … since the course seems to have secondary teaching goals that are not stated… I assume I had achieved the learning goal
:-)
0 -
To be clear, the exercise itself was fine, I was talking about the end-of-chapter review quiz question.
I used the final state of the exercise to try to get the result claimed in the quiz answer key, and failing that, looked in the k8s, where I found an answer that did not match the review quiz answer.
0 -
update with below and have a try
requests: cpu: "3" memory: "16Gi"0 -
@yang.wang11 said:
update with below and have a tryrequests: cpu: "3" memory: "16Gi"With only 8Gibytes of RAM on the nodes, that configuration means it won't ever be scheduled, so will never have the chance to use too much memory and be evicted/OOM killed.
0 -
It's a bad question in my opinion. Too loosely phrased.
From k8s docs: "If a container exceeds its memory request and the node that it runs on becomes short of memory overall, it is likely that the Pod the container belongs to will be evicted."
Also: "If the node where a Pod is running has enough of a resource available, it's possible (and allowed) for a container to use more resource than its request for that resource specifies."
So, i can deduct that, tldr: Eviction happens due to node pressure, not just “memory usage”: "However, terminations only happen when the kernel detects memory pressure."
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
0
Categories
- All Categories
- 177 LFX Mentorship
- 177 LFX Mentorship: Linux Kernel
- 754 Linux Foundation IT Professional Programs
- 374 Cloud Engineer IT Professional Program
- 170 Advanced Cloud Engineer IT Professional Program
- 74 DevOps IT Professional Program - Discontinued
- 5 DevOps & GitOps IT Professional Program
- 100 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- 2 AI & ML Training
- 1 Blockchain & Decentralized Identity Training
- 5 Cloud & Containers Training
- 1 Cybersecurity Training
- 2 DevOps & Site-Reliability Training
- 1 Linux Kernel Development Training
- 1 Networking Training
- 2 Open Source Best Practice Training
- 2 System Administration Training
- 1 System Engineering Training
- 1 Web & Application Development Training
- 794 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 89 Storage
- 769 Linux Distributions
- 81 Debian
- 68 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 112 Mobile Computing
- 20 Android
- 77 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 393 Off Topic
- 121 Introductions
- 182 Small Talk
- 29 Study Material
- 976 Programming and Development
- 310 Kernel Development
- 648 Software Development
- 990 Software
- 382 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 Class Forum
- 1.4K LFS258 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)