首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Kubernetes指标无法获取pod/节点指标

Kubernetes指标无法获取pod/节点指标
EN

Stack Overflow用户
提问于 2018-09-07 22:39:14
回答 3查看 14.8K关注 0票数 12

我已经在kubernetes v1.11.2上安装了metrics-server。

我正在使用3个节点和1个主节点运行裸机集群

在metrics-server日志中,我有以下错误:

代码语言:javascript
复制
E0907 14:29:51.774592       1 manager.go:102] unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:vps01: unable to 
fetch metrics from Kubelet vps01 (vps01): Get https://vps01:10250/stats/summary/: dial tcp: lookup vps01 on 10.96.0.10:53: no such host, unable to fully scr
ape metrics from source kubelet_summary:vps04: unable to fetch metrics from Kubelet vps04 (vps04): Get https://vps04:10250/stats/summary/: dial tcp: lookup 
vps04 on 10.96.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:vps03: unable to fetch metrics from Kubelet vps03 (vps03): 
Get https://vps03:10250/stats/summary/: dial tcp: lookup vps03 on 10.96.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:vp
s02: unable to fetch metrics from Kubelet vps02 (vps02): Get https://vps02:10250/stats/summary/: dial tcp: lookup vps02 on 10.96.0.10:53: no such host]     
E0907 14:30:01.694794       1 reststorage.go:98] unable to fetch pod metrics for pod boxweb/boxweb-deployment-7756c49688-fz625: no metrics known for pod "bo
xweb/boxweb-deployment-7756c49688-fz625"                                                                                                                    
E0907 14:30:10.517886       1 reststorage.go:112] unable to fetch node metrics for node "vps01": no metrics known for node "vps01"

我也无法使用kubectl top node vps01获得任何指标

自动缩放也是如此,它不起作用

代码语言:javascript
复制
  unable to get metrics for resource cpu: unable to fetch metrics from
 resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)       
EN

回答 3

Stack Overflow用户

发布于 2018-09-12 04:24:19

我找到了以下解决方案:

更改metrics-server-deployment.yaml文件并添加:

代码语言:javascript
复制
command:
    - /metrics-server 
    - --kubelet-preferred-address-types=InternalIP
    - --kubelet-insecure-tls
票数 10
EN

Stack Overflow用户

发布于 2018-09-08 08:16:49

看起来您的metrics-server pod出现了DNS问题。您可以连接到pod:

代码语言:javascript
复制
kubectl exec -it metrics-server-xxxxxxxxxx-xxxxx -n kube-system sh
/ # ping vps01

如果你不能ping你不能解析你的节点。

core-dns或kube-dns也在您的节点上使用各自的/etc/resolv.conf,因此我将检查您是否可以解析彼此之间的节点。比如说,你能从vps02vps03等ping通vps01吗?

票数 1
EN

Stack Overflow用户

发布于 2019-06-14 14:12:05

我遇到了同样的问题,我通过在每个节点上的/etc/hosts中添加主机名解决了这个问题。

为了收集度量数据(CPU/内存使用情况),度量服务器尝试访问节点。但是,度量服务器无法解析主机名(vps01vps02vps03vps04),因为这些主机名未在DNS中注册。正如您所提到的,您不能在DNS中注册主机名。

因此,您必须在运行指标服务器POD的节点上将主机名添加到/etc/hosts

自动缩放器不工作,因为指标服务器不工作并且没有指标数据。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52224829

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档