create a "Best-effort" pod and its oom score not 1000 but -999

2/4/2017

Create a deployment as below:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    owt: hello
    pdl: com
    app: world
    idc: xg
    add: parameters-48
  name: parameters-48
spec:
  replicas: 2
  template:
    metadata:
      labels:
        name: parameters-48
    spec:
      containers:
      - name: mofang-web
        image: registry.cc.com/online/mofang:stable
      nodeSelector:
        node:cc

Login to node found the container's pid, then check its oom score:

cat /proc/21606/oom_adj
-16
cat /proc/21606/oom_score
0
cat /proc/21606/oom_score_adj
-999

According user guide page: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/resource-qos.md, this pod should be a "Best-effort" pod, but its OOM_SCORE_ADJ not 1000 but -999. By the way -999 means won't be oom killed.

-- workhardcc
docker
kubernetes

1 Answer

2/10/2017

Following the issue, it's maybe worth to summarize how to find the correct container pid / proc for a pod:

Run some application:

$ kubectl run bootcamp --image=docker.io/jocatalin/kubernetes-bootcamp:v1

Find the containerID:

$ kubectl get pods --output=jsonpath='{.items[*].status.containerStatuses[*].containerID}'
docker://59f127d641cef9475309cbf4b5fc2e4a65f3e52a0e08112dccbc2c144a0e366f

Find the related host / node:

$ kubectl get pods --output=jsonpath='{.items[*].status.hostIP}'                          
192.168.99.100

Both could also be found with:

$ kubectl describe pod <podID>

Connect to the node via SSH, then run:

$ docker inspect 59f127d641cef9475309cbf4b5fc2e4a65f3e52a0e08112dccbc2c144a0e366f | grep Pid\":
"Pid": 18052,
$ cat /proc/18052/oom_*         
15
1000
1000

Hope this helps someone else at some point

-- pagid
Source: StackOverflow