Forum Navigation
You need to log in to create posts and topics.

Error from server (ServiceUnavailable): the server is currently unable to handle the request (get pods.metrics.k8s.io)

Problem

User is trying to run the command

kubectl top pod –all-namespaces

or

kubectl top node –all-namespaces

and get the following error

Error from server (ServiceUnavailable): the server is currently unable to handle the request (get pods.metrics.k8s.io)

Solution

first make sure metrics-server is installed

kubectl get po -n kube-system |grep metrics

if not add metrics server

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
if the command ” kubectl top node –all-namespaces “ still returning error then add configuration to policy
kubectl edit deployment.apps -n kube-system metrics-server
search for line with dnsPolicy: ClusterFirst
and add below the line
hostNetwork: true