kubenetes metrics-server監控資源

z597011036發表於2022-07-26

metrics-server版本相容:

1.檢視節點資源錯誤

[root@test35 ~]# kubectl top node 

W0726 13:34:14.328777   14884 top_node.go:119] Using json format to get metrics. Next release will switch to protocol-buffers, switch early by passing --use-protocol-buffers flag

error: Metrics API not available

[root@test35 ~]#


2.下載映象

[root@test35 ~]# grep image  components.yaml 

        image: k8s.gcr.io/metrics-server/metrics-server:v0.6.0   --檢視映象倉庫

        imagePullPolicy: IfNotPresent

[root@test35 ~]# docker pull registry.cn-hangzhou.aliyuncs.com/zailushang/metrics-server:v0.6.0

v0.6.0: Pulling from zailushang/metrics-server

2df365faf0e3: Pull complete 

aae7d2b1eda3: Pull complete 

Digest: sha256:60a353297a2b74ef6eea928fe2d44efc8d8e6298441bf1184b2e3bc25ca1b3e2

Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/zailushang/metrics-server:v0.6.0

registry.cn-hangzhou.aliyuncs.com/zailushang/metrics-server:v0.6.0

You have mail in /var/spool/mail/root

[root@test35 ~]# docker tag registry.cn-hangzhou.aliyuncs.com/zailushang/metrics-server:v0.6.0 k8s.gcr.io/metrics-server/metrics-server:v0.6.0

[root@test35 ~]# docker images | grep metrics

registry.cn-hangzhou.aliyuncs.com/zailushang/metrics-server       v0.6.0     5787924fe1d8   6 months ago    68.8MB

k8s.gcr.io/metrics-server/metrics-server                          v0.6.0     5787924fe1d8   6 months ago    68.8MB

[root@test35 ~]#


3.部署metrics-server元件

下載地址:

[root@test35 ~]# kubectl apply -f  components.yaml

serviceaccount/metrics-server created

clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created

clusterrole.rbac.authorization.k8s.io/system:metrics-server created

rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created

clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created

clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created

service/metrics-server created

deployment.apps/metrics-server created

apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created

[root@test35 ~]# 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25854343/viewspace-2907649/,如需轉載,請註明出處,否則將追究法律責任。

相關文章