unable to retrieve the complete list of server APIs

2 min read | by Jordi Prats

While performing any action we might encounter the following error:

error: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently unable to handle the request

This error is caused by the metrics server being down for some error, or in case it has been deleted. We can check the list of api services using kubectl get apiservice:

$ kubectl get apiservice
NAME                                   SERVICE                      AVAILABLE                  AGE
v1.                                    Local                        True                       133d
v1beta1.admissionregistration.k8s.io   Local                        True                       133d
(...)
v1.acme.cert-manager.io                Local                        True                       44h
v1.cert-manager.io                     Local                        True                       44h
v1beta1.metrics.k8s.io                 kube-system/metrics-server   False (MissingEndpoints)   133d

If we want to get rid of this error we can just removed the apiservice using kubectl delete apiservice as follows:

$ kubectl delete apiservice v1beta1.metrics.k8s.io
apiservice.apiregistration.k8s.io "v1beta1.metrics.k8s.io" deleted

Once the metrics server is fixed we can always add it back. It can also happen if you have installed a monitoring service such as prometheus and you have either dropped the entire namespace or there's a configuration issue that prevents it to start.

In my case I dropped the prometheus namespace without taking into consideration the service that was registered. Just bu removing the unavailable API service it fixed the issue


Posted on 03/05/2021