安装Metrics server
跳到导航
跳到搜索
==
首先上官方选择下载你想要的版本 metri# grep -rn image components.yaml 140: image: k8s.gcr.io/metrics-server/metrics-server:v0.6.1 141: imagePullPolicy: IfNotPresent root@ubuntu-200470-1:~/metri# sed -i "s#k8s.gcr.io/metrics-server#registry.cn-hangzhou.aliyuncs.com/chenby#g" components.yaml root@ubuntu-200470-1:~/metri# grep -rn image components.yaml 140: image: registry.cn-hangzhou.aliyuncs.com/chenby/metrics-server:v0.6.1 141: imagePullPolicy: IfNotPresent root@ubuntu-200470-1:~/metri# vi components.yaml 添加"- --kubelet-insecure-tls" 例: args: - --cert-dir=/tmp - --secure-port=4443 - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname - --kubelet-use-node-status-port - --metric-resolution=15s - --kubelet-insecure-tls image: registry.cn-hangzhou.aliyuncs.com/chenby/metrics-server:v0.6.1 root@ubuntu-200470-1:~/metri# 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@ubuntu-200470-1:~/metri# kubectl get pod -n kube-system | grep metrics metrics-server-845bcff787-q6zk9 0/1 Running 0 21s root@ubuntu-200470-1:~/metri# kubectl top nodes NAME CPU(cores) CPU% MEMORY(bytes) MEMORY% master 292m 7% 2212Mi 39% work1 127m 3% 1438Mi 30% work2 142m 3% 2048Mi 43%
==