<p>I am getting <code>ServiceUnavailable</code> error when I try to run <code>kubectl top nodes</code> or <code>kubectl top pods</code> command in EKS. I am running my cluster in EKS , and I am not finding any solution for this online. If any one have faced this issue in EKS please let me know how we can resolve this issue</p>
<pre><code>Error from server (ServiceUnavailable): the server is currently unable to handle the request (get pods.metrics.k8s.io)
</code></pre>
<p>out put of <code>kubectl get apiservices v1beta1.metrics.k8s.io -o yaml</code></p>
<pre><code>apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {&quot;apiVersion&quot;:&quot;apiregistration.k8s.io/v1&quot;,&quot;kind&quot;:&quot;APIService&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;labels&quot;:{&quot;k8s-app&quot;:&quot;metrics-server&quot;},&quot;name&quot;:&quot;v1beta1.metrics.k8s.io&quot;},&quot;spec&quot;:{&quot;group&quot;:&quot;metrics.k8s.io&quot;,&quot;groupPriorityMinimum&quot;:100,&quot;insecureSkipTLSVerify&quot;:true,&quot;service&quot;:{&quot;name&quot;:&quot;metrics-server&quot;,&quot;namespace&quot;:&quot;kube-system&quot;},&quot;version&quot;:&quot;v1beta1&quot;,&quot;versionPriority&quot;:100}}
  creationTimestamp: &quot;2022-02-03T08:22:59Z&quot;
  labels:
    k8s-app: metrics-server
  name: v1beta1.metrics.k8s.io
  resourceVersion: &quot;1373088&quot;
  uid: 2066d4cb-8105-4aea-9678-8303595dc47b
spec:
  group: metrics.k8s.io
  groupPriorityMinimum: 100
  insecureSkipTLSVerify: true
  service:
    name: metrics-server
    namespace: kube-system
    port: 443
  version: v1beta1
  versionPriority: 100
status:
  conditions:
  - lastTransitionTime: &quot;2022-02-03T08:22:59Z&quot;
    message: 'failing or missing response from https://10.16.55.204:4443/apis/metrics.k8s.io/v1beta1:
      Get &quot;https://10.16.55.204:4443/apis/metrics.k8s.io/v1beta1&quot;: dial tcp 10.16.55.204:4443:
      i/o timeout'
    reason: FailedDiscoveryCheck
    status: &quot;False&quot;
    type: Available
</code></pre>
<p><code>metrics-server   1/1     1            1           3d22h</code></p>
<p><code>kubectl describe deployment metrics-server -n kube-system</code></p>
<pre><code>Name:                   metrics-server
Namespace:              kube-system
CreationTimestamp:      Thu, 03 Feb 2022 09:22:59 +0100
Labels:                 k8s-app=metrics-server
Annotations:            deployment.kubernetes.io/revision: 2
Selector:               k8s-app=metrics-server
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  0 max unavailable, 25% max surge
Pod Template:
  Labels:           k8s-app=metrics-server
  Service Account:  metrics-server
  Containers:
   metrics-server:
    Image:      k8s.gcr.io/metrics-server/metrics-server:v0.6.0
    Port:       4443/TCP
    Host Port:  0/TCP
    Args:
      --cert-dir=/tmp
      --secure-port=4443
      --kubelet-insecure-tls=true
      --kubelet-preferred-address-types=InternalIP
      --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
      --kubelet-use-node-status-port
      --metric-resolution=15s
    Requests:
      cpu:        100m
      memory:     200Mi
    Liveness:     http-get https://:https/livez delay=0s timeout=1s period=10s #success=1 #failure=3
    Readiness:    http-get https://:https/readyz delay=20s timeout=1s period=10s #success=1 #failure=3
    Environment:  &lt;none&gt;
    Mounts:
      /tmp from tmp-dir (rw)
  Volumes:
   tmp-dir:
    Type:               EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:          &lt;unset&gt;
  Priority Class Name:  system-cluster-critical
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Progressing    True    NewReplicaSetAvailable
  Available      True    MinimumReplicasAvailable
OldReplicaSets:  &lt;none&gt;
NewReplicaSet:   metrics-server-5dcd6cbcb9 (1/1 replicas created)
Events:          &lt;none&gt;
</code></pre>

Waseem Mir
<p>Download the <a href="https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml" rel="nofollow noreferrer">components.yaml</a>, find and replace 4443 to 443 and do a <code>kubectl replace -f components.yaml -n kube-system --force</code>.</p>
