问题的原因为资源文件的版本定义过期了。需要修改下
┌──[root@vms81.liruilongs.github.io]-[~/ansible/metrics/deploy/1.8+]
└─$kubectl apply -f .
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader unchanged
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created
serviceaccount/metrics-server unchanged
deployment.apps/metrics-server unchanged
service/metrics-server unchanged
clusterrole.rbac.authorization.k8s.io/system:metrics-server unchanged
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server unchanged
unable to recognize "auth-reader.yaml": no matches for kind "RoleBinding" in version "rbac.authorization.k8s.io/v1beta1"
unable to recognize "metrics-apiservice.yaml": no matches for kind "APIService" in version "apiregistration.k8s.io/v1beta1"
修改下版本
┌──[root@vms81.liruilongs.github.io]-[~/ansible/metrics/deploy/1.8+]
└─$sed -i 's#apiregistration.k8s.io/v1beta1#apiregistration.k8s.io/v1#' metrics-apiservice.yaml
┌──[root@vms81.liruilongs.github.io]-[~/ansible/metrics/deploy/1.8+]
└─$sed -i 's#rbac.authorization.k8s.io/v1beta1#rbac.authorization.k8s.io/v1#' auth-reader.yaml
┌──[root@vms81.liruilongs.github.io]-[~/ansible/metrics/deploy/1.8+]
└─$kubectl apply -f .
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader unchanged
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator unchanged
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created
serviceaccount/metrics-server unchanged
deployment.apps/metrics-server unchanged
service/metrics-server unchanged
clusterrole.rbac.authorization.k8s.io/system:metrics-server unchanged
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server unchanged
┌──[root@vms81.liruilongs.github.io]-[~/ansible/metrics/deploy/1.8+]
└─$kubectl get pods
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-78d6f96c7b-6xrw7 1/1 Running 0 122m
calico-node-6nfqv 1/1 Running 0 122m
calico-node-fv458 1/1 Running 0 122m
calico-node-h5lsq 1/1 Running 0 122m
coredns-7f6cbbb7b8-5szpz 1/1 Running 0 129m
coredns-7f6cbbb7b8-q4x82 1/1 Running 0 129m
etcd-vms81.liruilongs.github.io 1/1 Running 98 129m
kube-apiserver-vms81.liruilongs.github.io 1/1 Running 1 129m
kube-controller-manager-vms81.liruilongs.github.io 1/1 Running 154 129m
kube-proxy-scs6x 1/1 Running 0 123m
kube-proxy-tbwz5 1/1 Running 0 129m
kube-proxy-xccmp 1/1 Running 0 123m
kube-scheduler-vms81.liruilongs.github.io 1/1 Running 148 129m
metrics-server-bcfb98c76-jldxc 1/1 Running 9 (5m21s ago) 21m
┌──[root@vms81.liruilongs.github.io]-[~/ansible/metrics/deploy/1.8+]
└─$kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
vms81.liruilongs.github.io 401m 20% 1562Mi 40%
vms82.liruilongs.github.io 228m 11% 743Mi 19%
vms83.liruilongs.github.io 221m 11% 720Mi 18%
┌──[root@vms81.liruilongs.github.io]-[~/ansible/metrics/deploy/1.8+]
└─$