unable to retrieve the complete list of server APIs

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 matrics server is fixed we can always add it back

Posted on 03/05/2021