k8s docker 容器被kill,原因查看

描述:
在rancher查询不到任何memory溢出信息,转向查看系统日志
1、内核日志 /var/log/messages
dmesg打印环形缓冲区的内容。这些信息还会实时发送到syslogd或klogd(在它们运行时),最终以形式发送给/var/log/messages;什么时候dmesg最有用是捕获之前syslogd和/或klogd开始的启动时消息,以便将它们正确记录。
2、dmesg | grep -i -B100 'killed process'
一旦设置了内存限制,将立即生效,并且当物理内存使用量达到limit的时候,memory.failcnt的内容会加1,但这时进程不一定就会被kill掉,内核会尽量将物理内存中的数据移到swap空间上去,如果实在是没办法移动了(设置的limit过小,或者swap空间不足),默认情况下,就会kill掉cgroup里面继续申请内存的进程。

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"}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,753评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,668评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,090评论 0 356
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,010评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,054评论 6 395
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,806评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,484评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,380评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,873评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,021评论 3 338
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,158评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,838评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,499评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,044评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,159评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,449评论 3 374
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,136评论 2 356

推荐阅读更多精彩内容

  • 基于Syslog 的日志系统 一、简介 syslog是Linux系统默认的日志守护进程。默认的主配置文件和辅助配置...
    key天空阅读 933评论 0 1
  • 正在连接的ip centos7netstat -nat|grep ":80"|awk '{print 1}' | ...
    半步江南阅读 721评论 0 0
  • 基础知识 Docker 引擎日志 Docker 引擎日志 一般是交给了 Upstart(Ubuntu 14.04)...
    陈sir的知识图谱阅读 742评论 0 0
  • 日志介绍 日志 记录历史事件:时间,地点,人物,事件 日志级别:事件的关键性程度,Loglevel 系统日志服务 ...
    Ben0606阅读 1,736评论 0 2
  • 推荐指数: 6.0 书籍主旨关键词:特权、焦点、注意力、语言联想、情景联想 观点: 1.统计学现在叫数据分析,社会...
    Jenaral阅读 5,721评论 0 5