minikube: Error "Metrics not available for pod" while checking the metrics of Pods using "metrics-server" add-on

What Happened?

After enabling metrics-server add-on using minikube addons enable metrics-server command I tried to check the metrics of the Pods in kube-system namespace or just of the Pods that I created manually in default namespace.

This is what I got:

meliwex@vmubuntu:~$ kubectl top pods 
error: Metrics not available for pod default/dpl-test-6fb55dc999-lmxfm, age: 2m24.964714409s
meliwex@vmubuntu:~$ kubectl top pods -n kube-system
error: Metrics not available for pod kube-system/coredns-64897985d-9rksw, age: 25m27.304057516s

The metrics-server is running:

metrics-server-6b76bd68b6-6tk7p    1/1     Running

My environment: Output of minikube version: minikube version: v1.25.2

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:58:47Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:19:12Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}

I am using VirtualBox Virtual Machine with OS Ubuntu Server 20.04 LTS.

Notes: I got also the same error in AWS EC2 instance with the same OS. Using kind I didn’t have any problem with metrics-server, everything worked well. I guess the problem is related to minikube.

Attach the log file

log.txt

Output of: kubectl logs metrics-server-6b76bd68b6-6tk7p -n kube-system

I0417 07:03:39.667629       1 serving.go:325] Generated self-signed cert (/tmp/apiserver.crt, /tmp/apiserver.key)
I0417 07:03:42.246802       1 secure_serving.go:197] Serving securely on [::]:4443
I0417 07:03:42.246848       1 dynamic_serving_content.go:130] Starting serving-cert::/tmp/apiserver.crt::/tmp/apiserver.key
I0417 07:03:42.246870       1 tlsconfig.go:240] Starting DynamicServingCertificateController
I0417 07:03:42.247030       1 requestheader_controller.go:169] Starting RequestHeaderAuthRequestController
I0417 07:03:42.247090       1 shared_informer.go:240] Waiting for caches to sync for RequestHeaderAuthRequestController
I0417 07:03:42.247154       1 configmap_cafile_content.go:202] Starting client-ca::kube-system::extension-apiserver-authentication::client-ca-file
I0417 07:03:42.247203       1 shared_informer.go:240] Waiting for caches to sync for client-ca::kube-system::extension-apiserver-authentication::client-ca-file
I0417 07:03:42.247251       1 configmap_cafile_content.go:202] Starting client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file
I0417 07:03:42.247300       1 shared_informer.go:240] Waiting for caches to sync for client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file
I0417 07:03:42.347306       1 shared_informer.go:247] Caches are synced for client-ca::kube-system::extension-apiserver-authentication::client-ca-file 
I0417 07:03:42.347382       1 shared_informer.go:247] Caches are synced for client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file 
I0417 07:03:42.348176       1 shared_informer.go:247] Caches are synced for RequestHeaderAuthRequestController 

Operating System

Ubuntu

Driver

Docker

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28 (6 by maintainers)

Most upvoted comments

Hi @meliwex, thanks for reporting your issue with minikube!

This is a known issue which has since been fixed but hasn’t been released yet.

Try deleting your instances minikube delete and then add --extra-config=kubelet.housekeeping-interval=10s to your start args and that should enable metrics reporting again.

Thanks @spowelljr , minikube start --extra-config=kubelet.housekeeping-interval=10s resolved the issue for me.

Try deleting your instances minikube delete it seems just stop/start is enough