gpt4 book ai didi

kubernetes - 无法获取cpu pod指标,k8s-容器-容器-shim-runsc-v1-gvisor

转载 作者:行者123 更新时间:2023-12-02 12:26:04 31 4
gpt4 key购买 nike

我从gvisor-containerd-shim(Shim V1)移到了containerd-shim-runsc-v1(Shim V2)。在使用gvisor-containerd-shim的情况下,指标服务器和Horizo​​ntal Pod Autoscaler可以正常工作。
但是现在,通过containerd-shim-runsc-v1,我不断获取节点和Runc Pod的CPU和内存指标,但是我仅获取runc(gvisor)Pod的内存指标。
例如,我将一个PHP服务器部署在带有containerd-shim-runsc-v1的gvisor容器中。我得到以下指标:

kubectl get hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
php-apache Deployment/php-apache 0%/50% 1 10 1 68s


kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
snf-877559 549m 13% 2327Mi 39%


kubectl top pods
NAME CPU(cores) MEMORY(bytes)
php-apache-gvisor-6f7bb6cf84-28qdk 0m 52Mi
将一些负载发送到php-apache-gvisor容器后,我可以看到该节点和Runc容器(负载生成器)的CPU和内存使用增量。 我还可以看到php-apache-gvisor的内存从52 Mi增加到72 Mi,但是它的CPU使用率保持在0%。 为什么cpu的使用率保持在0%?
我也尝试过使用不同的容器图像,但是得到的结果仍然相同。
通过负载,我得到以下指标:
kubectl get hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
php-apache Deployment/php-apache 0%/50% 1 10 1 68s


kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
snf-877559 946m 23% 2413Mi 41%


kubectl top pods
NAME CPU(cores) MEMORY(bytes)
load-generator-7d549cd44-xmbqw 3m 1Mi
php-apache-gvisor-6f7bb6cf84-28qdk 0m 72Mi
更多信息:
kubeadm,kubernetes 1.15.3,容器化1.3.3,夜间runc / 2019-09-18,法兰绒
kubectl logs metrics-server-74657b4dc4-8nlzn -n kube-system
I0728 09:33:42.449921 1 serving.go:312] Generated self-signed cert (/tmp/apiserver.crt, /tmp/apiserver.key)
I0728 09:33:44.153682 1 secure_serving.go:116] Serving securely on [::]:4443
E0728 09:35:24.579804 1 reststorage.go:160] unable to fetch pod metrics for pod default/php-apache-gvisor-6f7bb6cf84-28qdk: no metrics known for pod
E0728 09:35:39.940417 1 reststorage.go:160] unable to fetch pod metrics for pod default/php-apache-gvisor-6f7bb6cf84-28qdk: no metrics known for pod
/etc/containerd/config.toml(containerd-shim-runsc-v1)
subreaper = true
oom_score = -999
disabled_plugins = ["restart"]


[debug]
level = "debug"

[metrics]
address = "127.0.0.1:1338"

[plugins.linux]
runtime = "runc"
shim_debug = true


[plugins.cri.containerd.runtimes.runsc]
runtime_type = "io.containerd.runsc.v1"
/etc/containerd/config.toml(gvisor-containerd-shim)
subreaper = true
oom_score = -999
disabled_plugins = ["restart"]


[debug]
level = "debug"

[metrics]
address = "127.0.0.1:1338"

[plugins.linux]
runtime = "runc"
shim_debug = true
shim = "/usr/local/bin/gvisor-containerd-shim"


[plugins.cri.containerd.runtimes.runsc]
runtime_type = "io.containerd.runtime.v1.linux"
runtime_engine = "/usr/local/bin/runsc"
runtime_root = "/run/containerd/runsc"
指标服务器yaml基于 https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.6/components.yaml和以下参数
....
containers:
- name: metrics-server
image: k8s.gcr.io/metrics-server-amd64:v0.3.6
imagePullPolicy: IfNotPresent
args:
- --kubelet-preferred-address-types=InternalIP
- --kubelet-insecure-tls
- --cert-dir=/tmp
- --secure-port=4443
....
当前部署具有以下资源部分
  resources:
limits:
cpu: 500m
requests:
cpu: 200m

最佳答案

gVisor当前仅按每个Pod报告内存和Pid。
另请:https://github.com/google/gvisor/blob/add40fd/runsc/boot/events.go#L62-L68
我们正计划导出更多统计信息,而跟踪该工作的问题在这里:
https://gvisor.dev/issue/172

关于kubernetes - 无法获取cpu pod指标,k8s-容器-容器-shim-runsc-v1-gvisor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63132692/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com