k8s docker 容器被kill,原因查看

描述:
在rancher查詢不到任何memory溢出信息,轉(zhuǎn)向查看系統(tǒng)日志
1、內(nèi)核日志 /var/log/messages
dmesg打印環(huán)形緩沖區(qū)的內(nèi)容。這些信息還會實時發(fā)送到syslogd或klogd(在它們運行時),最終以形式發(fā)送給/var/log/messages;什么時候dmesg最有用是捕獲之前syslogd和/或klogd開始的啟動時消息,以便將它們正確記錄。
2、dmesg | grep -i -B100 'killed process'
一旦設(shè)置了內(nèi)存限制,將立即生效,并且當物理內(nèi)存使用量達到limit的時候,memory.failcnt的內(nèi)容會加1,但這時進程不一定就會被kill掉,內(nèi)核會盡量將物理內(nèi)存中的數(shù)據(jù)移到swap空間上去,如果實在是沒辦法移動了(設(shè)置的limit過小,或者swap空間不足),默認情況下,就會kill掉cgroup里面繼續(xù)申請內(nèi)存的進程。

Feb 24 13:59:19 VM-96-82-centos kernel: [ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds swapents oom_score_adj name
Feb 24 13:59:19 VM-96-82-centos kernel: [375275]     0 375275      242        1       3       2        0          -998 pause
Feb 24 13:59:19 VM-96-82-centos kernel: [377832]     0 377832  4547750  1297084    2932      20        0          -998 java
Feb 24 13:59:19 VM-96-82-centos kernel: Memory cgroup out of memory: Kill process 375275 (pause) score 0 or sacrifice child
Feb 24 13:59:19 VM-96-82-centos kernel: Killed process 375275 (pause) total-vm:968kB, anon-rss:4kB, file-rss:0kB, shmem-rss:0kB
Feb 24 13:59:19 VM-96-82-centos kernel: oom_reaper: reaped process 375275 (pause), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Feb 24 13:59:19 VM-96-82-centos kernel: java invoked oom-killer: gfp_mask=0x14000c0(GFP_KERNEL), nodemask=(null),  order=0, oom_score_adj=-998
Feb 24 13:59:19 VM-96-82-centos kernel: java cpuset=38e2c43201daacb9053ff55dc2479cddc0fd7324ed76d0cd8fd2e077f52a9341 mems_allowed=0
Feb 24 13:59:19 VM-96-82-centos kernel: CPU: 37 PID: 914236 Comm: java Tainted: G        W       4.14.105-19-0018 #1
Feb 24 13:59:19 VM-96-82-centos kernel: Hardware name: Tencent Cloud CVM, BIOS seabios-1.9.1-qemu-project.org 04/01/2014
Feb 24 13:59:19 VM-96-82-centos kernel: Call Trace:
Feb 24 13:59:19 VM-96-82-centos kernel: dump_stack+0x63/0x87
Feb 24 13:59:19 VM-96-82-centos kernel: dump_header+0x9f/0x234
Feb 24 13:59:19 VM-96-82-centos kernel: ? mem_cgroup_scan_tasks+0x96/0xf0
Feb 24 13:59:19 VM-96-82-centos kernel: oom_kill_process+0x22c/0x440
Feb 24 13:59:19 VM-96-82-centos kernel: out_of_memory+0x114/0x4b0
Feb 24 13:59:19 VM-96-82-centos kernel: mem_cgroup_out_of_memory+0x4b/0x80
Feb 24 13:59:19 VM-96-82-centos kernel: mem_cgroup_oom_synchronize+0x2f9/0x320
Feb 24 13:59:19 VM-96-82-centos kernel: ? mem_cgroup_oom_unregister_event+0xb0/0xb0
Feb 24 13:59:19 VM-96-82-centos kernel: pagefault_out_of_memory+0x36/0x7c
Feb 24 13:59:19 VM-96-82-centos kernel: mm_fault_error+0x65/0x152
Feb 24 13:59:19 VM-96-82-centos kernel: __do_page_fault+0x420/0x500
Feb 24 13:59:19 VM-96-82-centos kernel: do_page_fault+0x32/0x100
Feb 24 13:59:19 VM-96-82-centos kernel: ? async_page_fault+0x2f/0x50
Feb 24 13:59:19 VM-96-82-centos kernel: do_async_page_fault+0x1a/0x80
Feb 24 13:59:19 VM-96-82-centos kernel: async_page_fault+0x45/0x50
Feb 24 13:59:19 VM-96-82-centos kernel: RIP: 0033:0x7fc156fa81d8
Feb 24 13:59:19 VM-96-82-centos kernel: RSP: 002b:00007fbf36ff4390 EFLAGS: 00010246
Feb 24 13:59:19 VM-96-82-centos kernel: RAX: 0000000000000000 RBX: 0000000762527f88 RCX: 0000000000000007
Feb 24 13:59:19 VM-96-82-centos kernel: RDX: 0000000762527f00 RSI: 000000000000002e RDI: 0000000762528000
Feb 24 13:59:19 VM-96-82-centos kernel: RBP: 0000000762527f18 R08: 0000000762528038 R09: 0000000762527fb8
Feb 24 13:59:19 VM-96-82-centos kernel: R10: 0000000000000036 R11: 0000000000000080 R12: 0000000000000000
Feb 24 13:59:19 VM-96-82-centos kernel: R13: 0000000000000002 R14: 0000000000000001 R15: 00007fc00800b000
Feb 24 13:59:19 VM-96-82-centos kernel: Task in /kubepods/pod9b444462-dab0-4f71-b4df-c90f405ecdd6/38e2c43201daacb9053ff55dc2479cddc0fd7324ed76d0cd8fd2e077f52a9341 killed as a result of limit of /kubepods/pod9b444462-dab0-4f71-b4df-c90f405ecdd6
Feb 24 13:59:19 VM-96-82-centos kernel: memory: usage 5242880kB, limit 5242880kB, failcnt 10576
Feb 24 13:59:19 VM-96-82-centos kernel: memory+swap: usage 5242880kB, limit 9007199254740988kB, failcnt 0
Feb 24 13:59:19 VM-96-82-centos kernel: kmem: usage 56472kB, limit 9007199254740988kB, failcnt 0
Feb 24 13:59:19 VM-96-82-centos kernel: Memory cgroup stats for /kubepods/pod9b444462-dab0-4f71-b4df-c90f405ecdd6: cache:0KB rss:0KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:0KB writeback:0KB swap:0KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB
Feb 24 13:59:19 VM-96-82-centos kernel: Memory cgroup stats for /kubepods/pod9b444462-dab0-4f71-b4df-c90f405ecdd6/3e1add7732688093e98afb20b4695cfb3fee2c0d5e1d5e11c78ac8b393ffb0b0: cache:0KB rss:0KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:0KB writeback:0KB swap:0KB inactive_anon:0KB active_anon:0KB inactive_file:0KB active_file:0KB unevictable:0KB
Feb 24 13:59:19 VM-96-82-centos kernel: Memory cgroup stats for /kubepods/pod9b444462-dab0-4f71-b4df-c90f405ecdd6/38e2c43201daacb9053ff55dc2479cddc0fd7324ed76d0cd8fd2e077f52a9341: cache:28KB rss:5186380KB rss_huge:0KB shmem:0KB mapped_file:0KB dirty:12KB writeback:0KB swap:0KB inactive_anon:0KB active_anon:5186380KB inactive_file:16KB active_file:12KB unevictable:0KB
Feb 24 13:59:19 VM-96-82-centos kernel: [ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds swapents oom_score_adj name
Feb 24 13:59:19 VM-96-82-centos kernel: [377832]     0 377832  4547750  1297084    2932      20        0          -998 java
Feb 24 13:59:19 VM-96-82-centos kernel: Memory cgroup out of memory: Kill process 377832 (java) score 0 or sacrifice child
Feb 24 13:59:19 VM-96-82-centos kernel: Killed process 377832 (java) total-vm:18191000kB, anon-rss:5173640kB, file-rss:14696kB, shmem-rss:0kB
Feb 24 13:59:20 VM-96-82-centos dockerd: time="2021-02-24T13:59:20.047541279+08:00" level=info msg="shim reaped" id=3e1add7732688093e98afb20b4695cfb3fee2c0d5e1d5e11c78ac8b393ffb0b0
Feb 24 13:59:20 VM-96-82-centos kubelet: E0224 13:59:20.051911    1521 kubelet_volumes.go:154] orphaned pod "e92eb114-c94c-4055-8bf1-8369878eaaf9" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.
Feb 24 13:59:20 VM-96-82-centos kernel: oom_reaper: reaped process 377832 (java), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Feb 24 13:59:20 VM-96-82-centos dockerd: time="2021-02-24T13:59:20.448074444+08:00" level=info msg="shim reaped" id=38e2c43201daacb9053ff55dc2479cddc0fd7324ed76d0cd8fd2e077f52a9341
Feb 24 13:59:20 VM-96-82-centos kernel: cbr0: port 32(veth3d17b63f) entered disabled state
Feb 24 13:59:20 VM-96-82-centos kernel: device veth3d17b63f left promiscuous mode
Feb 24 13:59:20 VM-96-82-centos kernel: cbr0: port 32(veth3d17b63f) entered disabled state
Feb 24 13:59:21 VM-96-82-centos kubelet: W0224 13:59:21.168030    1521 docker_sandbox.go:400] failed to read pod IP from plugin/docker: networkPlugin cni failed on the status hook for pod "kafka-mq-service-7c759ff88f-rgzhx_kafka-mq": CNI failed to retrieve network namespace path: cannot find network namespace for the terminated container "3e1add7732688093e98afb20b4695cfb3fee2c0d5e1d5e11c78ac8b393ffb0b0"
Feb 24 13:59:21 VM-96-82-centos kubelet: I0224 13:59:21.173135    1521 kubelet.go:1964] SyncLoop (PLEG): "kafka-mq-service-7c759ff88f-rgzhx_kafka-mq(9b444462-dab0-4f71-b4df-c90f405ecdd6)", event: &pleg.PodLifecycleEvent{ID:"9b444462-dab0-4f71-b4df-c90f405ecdd6", Type:"ContainerDied", Data:"38e2c43201daacb9053ff55dc2479cddc0fd7324ed76d0cd8fd2e077f52a9341"}
Feb 24 13:59:21 VM-96-82-centos kubelet: I0224 13:59:21.175593    1521 kubelet.go:1964] SyncLoop (PLEG): "kafka-mq-service-7c759ff88f-rgzhx_kafka-mq(9b444462-dab0-4f71-b4df-c90f405ecdd6)", event: &pleg.PodLifecycleEvent{ID:"9b444462-dab0-4f71-b4df-c90f405ecdd6", Type:"ContainerDied", Data:"3e1add7732688093e98afb20b4695cfb3fee2c0d5e1d5e11c78ac8b393ffb0b0"}
Feb 24 13:59:21 VM-96-82-centos kubelet: W0224 13:59:21.175613    1521 pod_container_deletor.go:77] Container "3e1add7732688093e98afb20b4695cfb3fee2c0d5e1d5e11c78ac8b393ffb0b0" not found in pod's containers
Feb 24 13:59:21 VM-96-82-centos kubelet: I0224 13:59:21.176708    1521 kuberuntime_manager.go:440] No ready sandbox for pod "kafka-mq-service-7c759ff88f-rgzhx_kafka-mq(9b444462-dab0-4f71-b4df-c90f405ecdd6)" can be found. Need to start a new one
Feb 24 13:59:21 VM-96-82-centos kubelet: W0224 13:59:21.183578    1521 cni.go:331] CNI failed to retrieve network namespace path: cannot find network namespace for the terminated container "3e1add7732688093e98afb20b4695cfb3fee2c0d5e1d5e11c78ac8b393ffb0b0"
Feb 24 13:59:21 VM-96-82-centos kubelet: 2021-02-24T13:59:21+08:00 [info] cmdDel: {containerId 3e1add7732688093e98afb20b4695cfb3fee2c0d5e1d5e11c78ac8b393ffb0b0, netNs , ifName eth0, args IgnoreUnknown=1;K8S_POD_NAMESPACE=kafka-mq;K8S_POD_NAME=kafka-mq-service-7c759ff88f-rgzhx;K8S_POD_INFRA_CONTAINER_ID=3e1add7732688093e98afb20b4695cfb3fee2c0d5e1d5e11c78ac8b393ffb0b0, path /opt/cni/bin, stdinData {"capabilities":{"bandwidth":true,"portMappings":true},"cniVersion":"0.3.1","defaultDelegates":"tke-bridge","kubeconfig":"/etc/kubernetes/tke-cni-kubeconfig","logLevel":"info","name":"multus-cni","runtimeConfig":{"portMappings":[]},"type":"multus"}}, <nil>, <nil>
Feb 24 13:59:21 VM-96-82-centos dockerd: time="2021-02-24T13:59:21.545070942+08:00" level=info msg="shim docker-containerd-shim started" address="/containerd-shim/moby/f7ae988c2781909ef0a6294ce54fa2c565e8563f6dc031c5352384200f213484/shim.sock" debug=false pid=2089417
Feb 24 13:59:22 VM-96-82-centos kubelet: W0224 13:59:22.053415    1521 volume_linux.go:49] Setting volume ownership for /var/lib/kubelet/pods/07f2fb8f-878f-430e-86ce-0cd2307e9d51/volumes/kubernetes.io~secret/default-token-dkgrc and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699
Feb 24 13:59:22 VM-96-82-centos kubelet: W0224 13:59:22.053502    1521 volume_linux.go:49] Setting volume ownership for /var/lib/kubelet/pods/07f2fb8f-878f-430e-86ce-0cd2307e9d51/volumes/kubernetes.io~secret/token-service-certificate and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699
Feb 24 13:59:22 VM-96-82-centos kubelet: W0224 13:59:22.053662    1521 volume_linux.go:49] Setting volume ownership for /var/lib/kubelet/pods/07f2fb8f-878f-430e-86ce-0cd2307e9d51/volumes/kubernetes.io~secret/config and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699
Feb 24 13:59:22 VM-96-82-centos kubelet: W0224 13:59:22.053674    1521 volume_linux.go:49] Setting volume ownership for /var/lib/kubelet/pods/07f2fb8f-878f-430e-86ce-0cd2307e9d51/volumes/kubernetes.io~secret/signer-certificate and fsGroup set. If the volume has a lot of files then setting volume ownership could be slow, see https://github.com/kubernetes/kubernetes/issues/69699
Feb 24 13:59:22 VM-96-82-centos kubelet: E0224 13:59:22.086259    1521 kubelet_volumes.go:154] orphaned pod "e92eb114-c94c-4055-8bf1-8369878eaaf9" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.
Feb 24 13:59:22 VM-96-82-centos kubelet: 2021-02-24T13:59:22+08:00 [info] cmdAdd: {containerId f7ae988c2781909ef0a6294ce54fa2c565e8563f6dc031c5352384200f213484, netNs /proc/2090213/ns/net, ifName eth0, args IgnoreUnknown=1;K8S_POD_NAMESPACE=kafka-mq;K8S_POD_NAME=kafka-mq-service-7c759ff88f-rgzhx;K8S_POD_INFRA_CONTAINER_ID=f7ae988c2781909ef0a6294ce54fa2c565e8563f6dc031c5352384200f213484, path /opt/cni/bin, stdinData {"capabilities":{"bandwidth":true,"portMappings":true},"cniVersion":"0.3.1","defaultDelegates":"tke-bridge","kubeconfig":"/etc/kubernetes/tke-cni-kubeconfig","logLevel":"info","name":"multus-cni","runtimeConfig":{"portMappings":[]},"type":"multus"}}, <nil>, <nil>
Feb 24 13:59:22 VM-96-82-centos kubelet: 2021-02-24T13:59:22+08:00 [info] getDelegateFromFile: &{Name:tke-bridge Namespace: IPRequest: MacRequest: InterfaceRequest:}, /etc/cni/net.d/multus
Feb 24 13:59:22 VM-96-82-centos kubelet: 2021-02-24T13:59:22+08:00 [info] getPodNetworkAnnotation: kafka-mq/kafka-mq-service-7c759ff88f-rgzhx,
Feb 24 13:59:22 VM-96-82-centos kubelet: 2021-02-24T13:59:22+08:00 [info] Get last index ifname eth0
Feb 24 13:59:22 VM-96-82-centos kernel: IPv6: ADDRCONF(NETDEV_UP): veth2d97b295: link is not ready
Feb 24 13:59:22 VM-96-82-centos kernel: IPv6: ADDRCONF(NETDEV_CHANGE): veth2d97b295: link becomes ready
Feb 24 13:59:22 VM-96-82-centos kernel: cbr0: port 8(veth2d97b295) entered blocking state
Feb 24 13:59:22 VM-96-82-centos kernel: cbr0: port 8(veth2d97b295) entered disabled state
Feb 24 13:59:22 VM-96-82-centos kernel: device veth2d97b295 entered promiscuous mode
Feb 24 13:59:22 VM-96-82-centos kernel: cbr0: port 8(veth2d97b295) entered blocking state
Feb 24 13:59:22 VM-96-82-centos kernel: cbr0: port 8(veth2d97b295) entered forwarding state
Feb 24 13:59:22 VM-96-82-centos kubelet: 2021-02-24T13:59:22+08:00 [info] setPodNetworkAnnotation: kafka-mq/kafka-mq-service-7c759ff88f-rgzhx, [{
Feb 24 13:59:22 VM-96-82-centos kubelet: "name": "tke-bridge",
Feb 24 13:59:22 VM-96-82-centos kubelet: "ips": [
Feb 24 13:59:22 VM-96-82-centos kubelet: "172.16.3.192"
Feb 24 13:59:22 VM-96-82-centos kubelet: ],
Feb 24 13:59:22 VM-96-82-centos kubelet: "default": true,
Feb 24 13:59:22 VM-96-82-centos kubelet: "dns": {}
Feb 24 13:59:22 VM-96-82-centos kubelet: }]
Feb 24 13:59:22 VM-96-82-centos kubelet: I0224 13:59:22.221561    1521 kubelet.go:1964] SyncLoop (PLEG): "kafka-mq-service-7c759ff88f-rgzhx_kafka-mq(9b444462-dab0-4f71-b4df-c90f405ecdd6)", event: &pleg.PodLifecycleEvent{ID:"9b444462-dab0-4f71-b4df-c90f405ecdd6", Type:"ContainerStarted", Data:"f7ae988c2781909ef0a6294ce54fa2c565e8563f6dc031c5352384200f213484"}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 基于Syslog 的日志系統(tǒng) 一、簡介 syslog是Linux系統(tǒng)默認的日志守護進程。默認的主配置文件和輔助配置...
    key天空閱讀 1,202評論 0 1
  • 正在連接的ip centos7netstat -nat|grep ":80"|awk '{print 1}' | ...
    半步江南閱讀 892評論 0 0
  • 基礎(chǔ)知識 Docker 引擎日志 Docker 引擎日志 一般是交給了 Upstart(Ubuntu 14.04)...
    陳sir的知識圖譜閱讀 839評論 0 0
  • 日志介紹 日志 記錄歷史事件:時間,地點,人物,事件 日志級別:事件的關(guān)鍵性程度,Loglevel 系統(tǒng)日志服務(wù) ...
    Ben0606閱讀 1,829評論 0 2
  • 推薦指數(shù): 6.0 書籍主旨關(guān)鍵詞:特權(quán)、焦點、注意力、語言聯(lián)想、情景聯(lián)想 觀點: 1.統(tǒng)計學(xué)現(xiàn)在叫數(shù)據(jù)分析,社會...
    Jenaral閱讀 5,967評論 0 5

友情鏈接更多精彩內(nèi)容