<p>When running 'kubectl top nodes' has error:</p>

<p>Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)</p>

<pre><code>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
</code></pre>

<p>And has no system error log.
How can I resolve this problem?</p>

<p>OS is :CentOS Linux release 7.5.1804 (Core)</p>

大傻瓜
<p>i had solved this problem, add <code>hostNetwork: true</code> to metries-server.yaml:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: metrics-server
  strategy:
    rollingUpdate:
      maxUnavailable: 0
  template:
    metadata:
      labels:
        k8s-app: metrics-server
    spec:
      hostNetwork: true ## add
</code></pre>
<p>docs:</p>
<pre class="lang-sh prettyprint-override"><code>[root@xx yaml]# kubectl explain deployment.spec.template.spec.hostNetwork
KIND:     Deployment
VERSION:  apps/v1

FIELD:    hostNetwork &lt;boolean&gt;

DESCRIPTION:
     Host networking requested for this pod. Use the host's network namespace.
     If this option is set, the ports that will be used must be specified.
     Default to false.
</code></pre>
<p>background:<br>
successful running metries, but <code>kubectl top nodes</code> occuied: <code>Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)</code>.</p>
