kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
k -n kube-system edit deploy metrics-server
containers: | |
- args: | |
- --cert-dir=/tmp | |
- --secure-port=4443 | |
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname | |
- --kubelet-use-node-status-port | |
- --metric-resolution=15s | |
command: | |
- /metrics-server | |
- --kubelet-insecure-tls | |
- --kubelet-preferred-address-types=InternalIP |
very useful for me thank you....
anyone know how to fix this error ? @NileshGule
Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)
And this is the result what I tried to log kubectl logs -n kube-system deploy/metrics-server
I1004 02:20:09.250465 1 serving.go:342] Generated self-signed cert (/tmp/apiserver.crt, /tmp/apiserver.key)
I1004 02:20:10.741119 1 requestheader_controller.go:169] Starting RequestHeaderAuthRequestController
I1004 02:20:10.741164 1 shared_informer.go:240] Waiting for caches to sync for RequestHeaderAuthRequestController
I1004 02:20:10.741156 1 configmap_cafile_content.go:201] "Starting controller" name="client-ca::kube-system::extension-apiserver-authentication::client-ca-file"
I1004 02:20:10.741235 1 configmap_cafile_content.go:201] "Starting controller" name="client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file"
I1004 02:20:10.741296 1 shared_informer.go:240] Waiting for caches to sync for client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file
I1004 02:20:10.741276 1 shared_informer.go:240] Waiting for caches to sync for client-ca::kube-system::extension-apiserver-authentication::client-ca-file
I1004 02:20:10.742445 1 dynamic_serving_content.go:131] "Starting controller" name="serving-cert::/tmp/apiserver.crt::/tmp/apiserver.key"
I1004 02:20:10.743275 1 secure_serving.go:266] Serving securely on [::]:4443
I1004 02:20:10.743512 1 tlsconfig.go:240] "Starting DynamicServingCertificateController"
W1004 02:20:10.743550 1 shared_informer.go:372] The sharedIndexInformer has started, run more than once is not allowed
I1004 02:20:10.841637 1 shared_informer.go:247] Caches are synced for client-ca::kube-system::extension-apiserver-authentication::client-ca-file
I1004 02:20:10.841656 1 shared_informer.go:247] Caches are synced for client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file
I1004 02:20:10.841798 1 shared_informer.go:247] Caches are synced for RequestHeaderAuthRequestController
I don't understand what is this error
The sharedIndexInformer has started, run more than once is not allowed
anyone know how to fix this error ? @NileshGule
Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io)
And this is the result what I tried to log
kubectl logs -n kube-system deploy/metrics-server
I1004 02:20:09.250465 1 serving.go:342] Generated self-signed cert (/tmp/apiserver.crt, /tmp/apiserver.key) I1004 02:20:10.741119 1 requestheader_controller.go:169] Starting RequestHeaderAuthRequestController I1004 02:20:10.741164 1 shared_informer.go:240] Waiting for caches to sync for RequestHeaderAuthRequestController I1004 02:20:10.741156 1 configmap_cafile_content.go:201] "Starting controller" name="client-ca::kube-system::extension-apiserver-authentication::client-ca-file" I1004 02:20:10.741235 1 configmap_cafile_content.go:201] "Starting controller" name="client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file" I1004 02:20:10.741296 1 shared_informer.go:240] Waiting for caches to sync for client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file I1004 02:20:10.741276 1 shared_informer.go:240] Waiting for caches to sync for client-ca::kube-system::extension-apiserver-authentication::client-ca-file I1004 02:20:10.742445 1 dynamic_serving_content.go:131] "Starting controller" name="serving-cert::/tmp/apiserver.crt::/tmp/apiserver.key" I1004 02:20:10.743275 1 secure_serving.go:266] Serving securely on [::]:4443 I1004 02:20:10.743512 1 tlsconfig.go:240] "Starting DynamicServingCertificateController" W1004 02:20:10.743550 1 shared_informer.go:372] The sharedIndexInformer has started, run more than once is not allowed I1004 02:20:10.841637 1 shared_informer.go:247] Caches are synced for client-ca::kube-system::extension-apiserver-authentication::client-ca-file I1004 02:20:10.841656 1 shared_informer.go:247] Caches are synced for client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file I1004 02:20:10.841798 1 shared_informer.go:247] Caches are synced for RequestHeaderAuthRequestController
I don't understand what is this error
The sharedIndexInformer has started, run more than once is not allowed
Is your metrics-server pods up and running?
download yaml file and add command session then apply
- args:
- --cert-dir=/tmp
- --secure-port=4443
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
- --kubelet-use-node-status-port
- --metric-resolution=15s
command:
- /metrics-server
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
@NileshGule I am still getting the same error
Readiness probe failed: HTTP probe failed with statuscode: 500
Use this link to resolve https://stackoverflow.com/questions/71843068/metrics-server-is-currently-unable-to-handle-the-request
kubectl edit deployments.apps -n kube-system metrics-server
Resolved by editing the deployment yaml files and adding the hostNetwork: true after the dnsPolicy: ClusterFirst
save the file and wait for a min and then check the kubectl top no
you made it .
everything worked perfectly but when I proceeded with kubectl top nodes it showed the error: Metrics API not available
Normal Created 3m28s kubelet Created container metrics-server
Normal Started 3m28s kubelet Started container metrics-server
@NileshGule @WasimAhmad
Awesome, it works for me!
Thank you for these!
Thank you very VERY much for this!
Thanks so much for this! it works for me!
Hi, Can someone let me know the location of this file kubernetes-metrics-server.yaml
@NileshGule I've follow the exactly steps provided and I still got no lucky. Any ideas?
same for me @ghost
For anyone getting the error i figured it out, see article - https://computingforgeeks.com/fix-error-metrics-api-not-available-in-kubernetes/
Glad that you found this useful 👍 @raghunath0326