java exit code 137_k8s pod OOMKill Exit Code: 137

Identify it is OOMKill

Reason should be OOMKill and the time is Finished

kubectl get pods testapp-v092-p8czf -o yaml | less -i

Last State: Terminated

Reason: OOMKilled

Exit Code: 137

Started: Fri, 11 Sep 2020 11:00:08 +0800

Finished: Mon, 14 Sep 2020 13:00:46 +0800

OOM heap dump ( when oomkill happen )

Container entrypoints add java start params

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=\.hprof

2. Mount an emptyDir for the pod In the pod lifecycle, /var/log/dump is durable.

3. Compress the dumpfile and download

gzip heapdump2020-09-15-03-198523874477783269974.hprof

kubectl cp testapp-v1127-xnbhq:/var/log/dump/heapdump2020-09-15-03-198523874477783269974.hprof.gz /tmp/heapdump2020-09-15-03-198523874477783269974.hprof.gz

Check List ( pod is already restarted )

check stackdirver applictaion logs

check memory and cpu limits

$ kubectl get pods testapp-v203-trsfl -o yaml

resources:

limits:

cpu: 1500m

memory: 1229Mi

requests:

cpu: 300m

memory: 1Gi

check kubectl top status

$ kubectl top pod testapp-v203-trsfl –containers

POD NAME CPU(cores) MEMORY(bytes)

testapp-v203-trsfl testapp 13m 1144Mi

testapp-v203-trsfl istio-proxy 5m 47Mi

new relic pod memory:

commands investigate java stack heap (inside pod)

apk add –no-cache jattach –repository http://dl-cdn.alpinelinux.org/alpine/edge/community/

jattach pid inspectheap

jattach pid jcmd VM.info

ps find RSS of process (inside pod)

$ kubectl exec -it testapp-v203-trsfl /bin/bash

ps -o pid,user,vsz,rss,comm,args

PID USER VSZ RSS COMMAND COMMAND

1 root 4332 720 tini /tini — /entrypoint.sh java

7 test 6.3g 1.1g java java -XX:+UseG1GC -Xms768m -Xmx768m -DREGION=gcp_hk -XX:+ExitOnOutOfMemoryError -XX:+UseStringDeduplication -XX:StringDeduplicationAgeThreshold=3 -agentlib:jdwp=transport=dt_socket,ser

18215 root 2620 2316 bash /bin/bash

18267 root 1572 20 ps ps -o pid,user,vsz,rss,comm,args

Issues:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值