运行'kubectl top nodes'时出现错误:
服务器出错(服务不可用):服务器当前无法处理请求(获取nodes.metrics.k8s.io)
k8s version:
kubectl version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:31:33Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
[root@manager ~]# kubectl api-versions
admissionregistration.k8s.io/v1beta1
apiextensions.k8s.io/v1beta1
apiregistration.k8s.io/v1
apiregistration.k8s.io/v1beta1
apps/v1
apps/v1beta1
apps/v1beta2
authentication.k8s.io/v1
authentication.k8s.io/v1beta1
authorization.k8s.io/v1
authorization.k8s.io/v1beta1
autoscaling/v1
autoscaling/v2beta1
autoscaling/v2beta2
batch/v1
batch/v1beta1
certificates.k8s.io/v1beta1
coordination.k8s.io/v1beta1
events.k8s.io/v1beta1
extensions/v1beta1
metrics.k8s.io/v1beta1
networking.k8s.io/v1
policy/v1beta1
rbac.authorization.k8s.io/v1
rbac.authorization.k8s.io/v1beta1
scheduling.k8s.io/v1beta1
storage.k8s.io/v1
storage.k8s.io/v1beta1
v1
[root@manager ~]# kubectl get po --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-86c58d9df4-km7jc 1/1 Running 0 2d21h
kube-system coredns-86c58d9df4-vltm9 1/1 Running 0 2d21h
kube-system etcd-manager 1/1 Running 0 2d23h
kube-system kube-apiserver-manager 1/1 Running 0 5h47m
kube-system kube-controller-manager-manager 1/1 Running 1 2d23h
kube-system kube-flannel-ds-amd64-5g8w8 1/1 Running 0 2d23h
kube-system kube-flannel-ds-amd64-69lcm 1/1 Running 0 2d23h
kube-system kube-flannel-ds-amd64-9hx2f 1/1 Running 0 2d23h
kube-system kube-proxy-9s6zm 1/1 Running 0 2d23h
kube-system kube-proxy-k4qwz 1/1 Running 0 2d23h
kube-system kube-proxy-wnzgd 1/1 Running 0 2d23h
kube-system kube-scheduler-manager 1/1 Running 1 2d23h
kube-system kubernetes-dashboard-79ff88449c-7fpw6 1/1 Running 0 2d23h
kube-system metrics-server-68d85f76bb-pj8bs 1/1 Running 0 111m
kube-system tiller-deploy-5478b6c547-bf82v 1/1 Running 0 4h7m
[root@manager ~]# kubectl logs -f -n kube-system metrics-server-68d85f76bb-pj8bs
I1217 06:42:43.451782 1 serving.go:273] Generated self-signed cert (apiserver.local.config/certificates/apiserver.crt, apiserver.local.config/certificates/apiserver.key)
[restful] 2018/12/17 06:42:44 log.go:33: [restful/swagger] listing is available at https://:443/swaggerapi
[restful] 2018/12/17 06:42:44 log.go:33: [restful/swagger] https://:443/swaggerui/ is mapped to folder /swagger-ui/
I1217 06:42:44.099720 1 serve.go:96] Serving securely on [::]:443
并且没有系统错误日志。如何解决此问题?
操作系统:CentOS Linux release 7.5.1804(Core)
2条答案
按热度按时间h79rfbju1#
我已经解决了这个问题,将
hostNetwork: true
添加到metries-server.yaml:文档:
背景:
成功运行度量,但发生了
kubectl top nodes
:Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)
。rur96b6h2#
此问题已解决:
1.删除代理(
file:/etc/kubernetes/manifests/kube-apiserver.yaml
)1.重启kubelet服务
kubectl top nodes
现在应该可以工作了