kubernetes: Kubelet inmediatelly eats all node's memory when livenessProbe command outputs infinite stdout

What happened: If a pod configures a livenessProbe command that just outputs infinitelly through stdout, kubelet quickly ends up eating all node’s memory, possibly ending up with OOM kills and the node going to unhealthy state.

What you expected to happen: Kubelet increases memory to store a certain amount of logs. The rest are just dropped.

How to reproduce it (as minimally and precisely as possible): You just need to create the next pod:

apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
  labels:
    app: myapp
spec:
  containers:
  - name: myapp-container
    image: busybox
    readinessProbe:
      exec:
        command:
        - "yes"
      failureThreshold: 3
      initialDelaySeconds: 10
      periodSeconds: 10
      successThreshold: 1
      timeoutSeconds: 1
    livenessProbe:
      exec:
        command:
        - "yes"
      failureThreshold: 3
      initialDelaySeconds: 10
      periodSeconds: 10
      successThreshold: 1
      timeoutSeconds: 1
    command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version): Reproduced on 1.6, 1.9 and 1.12
  • Cloud provider or hardware configuration: AWS
  • OS (e.g. from /etc/os-release): CoreOS 1800.7.0
  • Kernel (e.g. uname -a): Linux ip-10-24-15-116.eu-west-1.compute.internal 4.14.63-coreos #1 SMP Wed Aug 15 22:26:16 UTC 2018 x86_64 Intel® Xeon® CPU E5-2686 v4 @ 2.30GHz GenuineIntel GNU/Linux
  • Install tools: kube-aws (except for 1.12, which was using DCOS)
  • Others:

/kind bug

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 12
  • Comments: 24 (21 by maintainers)

Most upvoted comments

tested on 1.14.

After creating the pod on an empty cluster, on the node that the pod is scheduled kubelet exhausts the whole memory of the node, and after not-too-long, the node becomes unresponsive.

top - 10:42:11 up  2:08,  2 users,  load average: 11.54, 6.50, 2.89
Tasks: 276 total,   8 running, 268 sleeping,   0 stopped,   0 zombie
%Cpu(s): 73.2 us,  5.3 sy,  0.0 ni, 19.0 id,  0.0 wa,  1.6 hi,  0.5 si,  0.3 st
MiB Mem :  61399.3 total,    406.9 free,  55106.1 used,   5886.3 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.  10639.6 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                    
 1327 root      20   0   84.5g  52.2g  85580 S  41.5  87.0  11:08.09 kubelet                                                                                                                                                                    
17878 root      20   0  538304 223844   9804 S   8.3   0.4   2:22.79 ruby2.3     

imagen

imagen