Skip to content

oom_score default #3901

@vitality411

Description

@vitality411

Description

According to 1 and the output of containerd config default the default for oom_score is 0.
In 2 and 3 it is recommendet to set oom_score = -999.
Why not set an oom_score of -999 per default?

In an OOM situation containerd migth be killed, stop docker and kubelet due to systemd dependency and won't auto-restart (restart is fixed in #3297).

Dec 13 13:29:35 k8s-dev-569d8766d4-2ms9z kernel: Out of memory: Kill process 994 (containerd) score 4 or sacrifice child
Dec 13 13:29:35 k8s-dev-569d8766d4-2ms9z kernel: Killed process 994 (containerd) total-vm:907784kB, anon-rss:18912kB, file-rss:0kB, shmem-rss:0kB
...
Dec 13 13:29:34 k8s-dev-569d8766d4-2ms9z systemd[1]: containerd.service: Main process exited, code=killed, status=9/KILL
Dec 13 13:29:34 k8s-dev-569d8766d4-2ms9z systemd[1]: containerd.service: Failed with result 'signal'.
...
Dec 13 13:29:34 k8s-dev-569d8766d4-2ms9z systemd[1]: Stopping kubelet: The Kubernetes Node Agent...
Dec 13 13:30:43 k8s-dev-569d8766d4-2ms9z systemd[1]: Stopping Docker Application Container Engine...
Dec 13 13:30:43 k8s-dev-569d8766d4-2ms9z systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Dec 13 13:30:44 k8s-dev-569d8766d4-2ms9z systemd[1]: Stopped Docker Application Container Engine.
Dec 13 13:30:44 k8s-dev-569d8766d4-2ms9z systemd[1]: Closed Docker Socket for the API.

Steps to reproduce the issue:

  1. See docs and code
  2. Verify the following oom_scores_adj
    /proc/$(pidof kubelet)/oom_score_adj 
    /proc/$(pidof dockerd)/oom_score_adj 
    /proc/$(pidof containerd)/oom_score_adj 
    

Describe the results you received:

# containerd config default | grep oom
oom_score = 0
# cat /proc/$(pidof kubelet)/oom_score_adj
-999
# cat /proc/$(pidof dockerd)/oom_score_adj
-999
# cat /proc/$(pidof containerd)/oom_score_adj
0

Describe the results you expected:

# containerd config default | grep oom
oom_score = -999
# cat /proc/$(pidof kubelet)/oom_score_adj
-999
# cat /proc/$(pidof dockerd)/oom_score_adj
-999
# cat /proc/$(pidof containerd)/oom_score_adj
-999

Output of containerd --version:
containerd containerd.io 1.2.10 b34a5c8

Any other relevant information:
Output from a default Docker installation without Kubernetes:

cat /proc/$(pidof dockerd)/oom_score_adj
-500
cat /proc/$(pidof containerd)/oom_score_adj
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions