kubernetes - Kubernetes 指标服务器无法完全抓取指标
问题描述
当我尝试使用时kubectl top nodes
,出现此错误:
Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)
但是 heapster 已被弃用,我使用的是 kubernetes 1.11。我安装了metrics-server,但仍然遇到同样的错误,当我尝试检查metrics-server的日志时,我看到了这个错误:
E1019 12:33:55.621691 1 manager.go:102] unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:elegant-ardinghelli-ei3: unable to fetch metrics from Kubelet elegant-ardinghelli-ei3 (elegant-ardinghelli-ei3):
Get https://elegant-ardinghelli-ei3:10250/stats/summary/: dial tcp: lookup elegant-ardinghelli-ei3 on 10.245.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:elegant-ardinghelli-aab: unable to fetch metrics from Kubelet elegant-ardinghelli-aab (elegant-ardinghelli-aab):
Get https://elegant-ardinghelli-aab:10250/stats/summary/: dial tcp: lookup elegant-ardinghelli-aab on 10.245.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:elegant-ardinghelli-e4z: unable to fetch metrics from Kubelet elegant-ardinghelli-e4z (elegant-ardinghelli-e4z):
Get https://elegant-ardinghelli-e4z:10250/stats/summary/: dial tcp: lookup elegant-ardinghelli-e4z on 10.245.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:elegant-ardinghelli-e41: unable to fetch metrics from Kubelet elegant-ardinghelli-e41 (elegant-ardinghelli-e41):
Get https://elegant-ardinghelli-e41:10250/stats/summary/: dial tcp: lookup elegant-ardinghelli-e41 on 10.245.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:elegant-ardinghelli-ein: unable to fetch metrics from Kubelet elegant-ardinghelli-ein (elegant-ardinghelli-ein):
Get https://elegant-ardinghelli-ein:10250/stats/summary/: dial tcp: lookup elegant-ardinghelli-ein on 10.245.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:elegant-ardinghelli-aar: unable to fetch metrics from Kubelet elegant-ardinghelli-aar (elegant-ardinghelli-aar):
Get https://elegant-ardinghelli-aar:10250/stats/summary/: dial tcp: lookup elegant-ardinghelli-aar on 10.245.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:elegant-ardinghelli-aaj: unable to fetch metrics from Kubelet elegant-ardinghelli-aaj (elegant-ardinghelli-aaj):
Get https://elegant-ardinghelli-aaj:10250/stats/summary/: dial tcp: lookup elegant-ardinghelli-aaj on 10.245.0.10:53: no such host, unable to fully scrape metrics from source kubelet_summary:elegant-ardinghelli-e49: unable to fetch metrics from Kubelet elegant-ardinghelli-e49 (elegant-ardinghelli-e49):
Get https://elegant-ardinghelli-e49:10250/stats/summary/: dial tcp: lookup elegant-ardinghelli-e49 on 10.245.0.10:53: no such host]
解决方案
在此报道。
Github 问题:
此 PR 实现了对 kubectl top 命令的支持,以将 metrics-server 用作聚合 API,而不是直接从 heapster 请求指标。如果 apiserver 不提供 metrics.k8s.io API,那么这仍然会退回到以前的行为。
合并在https://github.com/kubernetes/kubernetes/pull/56206
可能在 1.12 中修复或计划在下一个版本中。
推荐阅读
- postgresql - Postgres 从两个 json 对象创建一个嵌套的 json 对象
- ios - 如何以编程方式在 iOS 设置应用程序中打开“首选语言”页面?
- reactjs - react-chartjs-2 (chart.js) 雷达 - 删除值?
- javascript - JS:为什么在继承另一个原型后需要重新设置构造函数?
- c# - 在取消和处理 CancellationTokenSource 之间存在延迟是否可以保证 IsCancellationRequested 将设置为 true?
- javascript - 找不到模块 axios - 与打字稿的兼容性问题
- javascript - Discord js在嵌入中使用消息ID
- c++ - 字符串未定向到输出文件(C++)
- python-3.x - 为什么使用 "+=" 附加到 List[str] 会导致意外的换行符,而 "c = c + a" 会导致 c 为空?
- java - 使用java中的方法交换单链表中的两个节点