K8s-------Helm之metrics-server的部署
Helm部署metrics-server(1)创建命名空间:kubectl create namespace metrics-server(2)拉取metrics-server:helm pull bitnami/metrics-server(3)部署metrics-server:helm install metrics-server . -n metrics-server(4)查看metrics
Helm部署metrics-server
(1)创建命名空间:kubectl create namespace metrics-server
(2)拉取metrics-server:helm pull bitnami/metrics-server
(3)部署metrics-server:helm install metrics-server . -n metrics-server
(4)查看metrics-server命名空间的信息:
kubectl get all -n metrics-server
- 查看pod的信息,pod未成功运行:存活探针失败
kubectl get pod -n metrics-serve
kubectl -n metrics-server describe metrics-server-777f7bd69b-h7pp5
- 查看pod的日志信息:
kubectl -n metrics-server logs metrics-server-777f7bd69b-h7pp5
报错:dial tcp: lookup server3 on 10.96.0.10:53: no such host, unable to fully scrape metrics from node server2: unable to fetch metrics from node server2: Get “https://server2:10250/stats/summary?only_cpu_and_memory=true”: dial tcp: lookup server2 on 10.96.0.10:53: no such host, unable to fully scrape metrics from node server4: unable to fetch metrics from node server4: Get “https://server4:10250/stats/summary?only_cpu_and_memory=true”: dial tcp: lookup server4 on 10.96.0.10:53: no such host]
错误的原因:这是因为没有内网的DNS服务器,所以metrics-server无法解析节点名字。可以直接修改coredns的configmap,讲各个节点的主机名加入到hosts中,这样所有Pod都可以从CoreDNS中解析各个节点的名字
解决方法
- 修改coredns的configmap:
kubectl edit configmaps coredns -n kube-system
- 重载coredns
kubectl -n kube-system delete pod coredns-7f89b7bc75-h6kcl
kubectl -n kube-system delete pod coredns-7f89b7bc75-tdtjt
kubectl -n metrics-server get all
- 查看metrics-server命名空间的信息:
kubectl -n metrics-server get all
,pod启动成功
(5)测试:kubectl top node
,查看节点的资源使用信息
更多推荐
所有评论(0)