ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

「Kubernetes Metrics Server」- 安装 @20210411

2021-04-11 14:35:33  阅读:208  来源: 互联网

标签:metrics Kubernetes 20210411 system Metrics unable pod kube


本笔记将记录如何部署 Metrics Server 组建。

Kubernetes Cluster v1.16

环境要求

Metrics Server 对网络和集群有特殊要求。这样要求在某些集群里不是默认配置,所以要先确认是否满足要求。

# 自从用了 Kubernetes 以后,就有看不完的文档和资源。在很多教程中,都是直接 apply 就可以,反正能用,说明这些依赖在大多数集群里都开启了。但是即使知道这样能够完成部署任务,我们还是得看文档。不看这些文档,就不知道这些东西是怎么工作的,故障时就难以排查。

Metrics Server must be reachable from kube-apiserver

The kube-apiserver must be correctly configured to enable an aggregation layer

Configure the Aggregation Layer - Kubernetes
检查 /etc/kubernetes/manifests/kube-apiserver.yaml 选项,默认已经开启。

Nodes must have kubelet authorization configured to match Metrics Server configuration

Container runtime must implement a container metrics RPCs

安装组建

第二步、修改配置信息

下载 components.yaml 文件,对其进行修改:
1)我们需要修改在 YAML 文件中的镜像地址,使用私有镜像仓库;
2)添加 --kubelet-preferred-address-types=InternalIP 与 --kubelet-insecure-tls 选项;

第三步、应用配置文件

kubectl apply -f "/path/to/components.yaml"

常见错误汇总

Metrics not available for pod

# kubectl top -n kube-system pod
W0702 10:48:07.400630    6619 top_pod.go:266] Metrics not available for pod kube-system/coredns-58cc8c89f4-6czm4, age: 4267h8m49.400600321s
error: Metrics not available for pod kube-system/coredns-58cc8c89f4-6czm4, age: 4267h8m49.400600321s

通过添加 --kubelet-preferred-address-types=InternalIP 与 --kubelet-insecure-tls 选项解决;

unable to fetch pod metrics for pod

E0702 02:39:09.777832       1 reststorage.go:160] unable to fetch pod metrics for pod default/counter: no metrics known for pod
E0702 02:39:09.777843       1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/etcd-k8s-master-02: no metrics known for pod
E0702 02:39:09.777863       1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/fluentd-p6d29: no metrics known for pod
E0702 02:39:09.777874       1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/kube-proxy-xdh2z: no metrics known for pod
E0702 02:39:09.777885       1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/etcd-k8s-master-01: no metrics known for pod
E0702 02:39:09.777900       1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/kube-proxy-jrpnd: no metrics known for pod

通过添加 --kubelet-preferred-address-types=InternalIP 与 --kubelet-insecure-tls 选项解决;

相关文章

「components.yaml」

参考文献

Kubernetes metrics-server Installation
Installing the Kubernetes Metrics Server
Kubernetes Metrics unable to fetch pod/node metrics - Stack Overflow


标签:metrics,Kubernetes,20210411,system,Metrics,unable,pod,kube
来源: https://www.cnblogs.com/k4nz/p/14643705.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有