-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: Metrics API not available #1282
Comments
Help me pls!! |
Hi, @bluemiaomiao ,Has the issue been solved? |
@yangjunmyfm192085 No indicators have been provided yet, and I haven’t investigated what happened internally. |
I have almost similar problem! I use the helm chart to install kube-metrics in one master and one worker,
|
/assign @yangjunmyfm192085 |
Hi, @bluemiaomiao @masazumi9527 Could you help provide more metrics-server logs? @masazumi9527 |
It does not work for me too. The metrics-server pods are running, I have set However, when I inquire using
|
Can you provide the logs of the metrics-server? |
Default containerPort is wrong in the latest release - #1236. Try overriding that to |
I encounter the same issue. Fresh install of Kubernetes, applying the
There is no error in the container :
|
did you check this step, edit metric server file? |
Hi @henzbnzr, Thank you. But, first, I don't want to use the Second, this option should go in the Third, even in trying this option, I still have the The
However, I don't know if it's a problem, but the error says |
I also have the same problem, which is still unresolved. Please help me, thank you apiVersion: apps/v1 [root@master metrics-server]# kubectl get pods -n kube-system [root@master metrics-server]# kubectl logs metrics-server-59dc595f65-spbh7 -n kube-system [root@master metrics-server]# kubectl get apiservices | grep metrics [root@master metrics-server]# kubectl get apiservice v1beta1.metrics.k8s.io -o yaml
[root@master metrics-server]# kubectl top node |
This worked for me, thanks to @NileshGule:
$ 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
$ k -n kube-system get pods
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-9d57d8f49-d26pd 1/1 Running 3 25h
canal-5xf7z 2/2 Running 0 11m
canal-mgtxd 2/2 Running 0 11m
coredns-7cbb7cccb8-gpnp5 1/1 Running 0 25h
coredns-7cbb7cccb8-qqcs6 1/1 Running 0 25h
etcd-controlplane 1/1 Running 0 25h
kube-apiserver-controlplane 1/1 Running 2 25h
kube-controller-manager-controlplane 1/1 Running 2 25h
kube-proxy-mk759 1/1 Running 0 25h
kube-proxy-wmp2n 1/1 Running 0 25h
kube-scheduler-controlplane 1/1 Running 2 25h
metrics-server-678d4b775-gqb65 1/1 Running 0 48s
|
I am seeing same issue on 1.27 and 0.6.3 metrics server. I have opened #1352 for the same. |
I had similar issue, metrics-server up & running where as top command is not working as expected, error says "error: Metrics API not available" with 1.28 version with pod n/w is Calico. - --kubelet-insecure-tls ---> this is at spec.containers.args section |
Thanks so much for this! it works for me! |
IMHO, if you ended by add the |
hi,
also result of below command not contain worker-03: also i configure metrics server deployment with below:
also there is same log in metrics-server pod: So, please let me your any graceful advice. |
This worked for me, kustomization.yaml resources:
- https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.7.1/components.yaml
patches:
- target:
kind: Deployment
labelSelector: "k8s-app=metrics-server"
patch: |-
- op: replace
path: /spec/template/spec/containers/0/args
value:
- --cert-dir=/tmp
- --secure-port=4443
- --kubelet-preferred-address-types=InternalIP
- --kubelet-use-node-status-port
- --metric-resolution=15s
- --kubelet-insecure-tls
- op: replace
path: /spec/template/spec/containers/0/ports
value:
- containerPort: 4443
name: https
protocol: TCP
|
I have solve that. I found the metrics-server was not in master node. When I add master node name in yaml and restore metrics-server, it works. spec: |
This works for me. Thank you! |
Thanks, wonderful. This work for me to solve the problem. |
Amazing solution, thanks for sharing. Working on Hetzner Cloud, Kubernetes 1.30. |
What's the reason for this? Is there some documentation about why metrics-server needs to be on a control-plane node? |
I struggled to solve the issue and documented the steps after finding the solution - https://computingforgeeks.com/fix-error-metrics-api-not-available-in-kubernetes/ |
with helm chart, this solved it
|
Verify your kube-api pods in kube-system are communicating properly with the API due to proxy issues... I had to add no_proxy to the I used HELM Chart (replicas == 3 enable HA), also used the nodeSelector with Hope this will help you, |
I can confirm helm install works after adding additional config (see bellow).
Without editing values.yaml I got following log entries:
My setup
helm: metrics-server 3.8.2 |
What happened:
What you expected to happen: Show metrics.
Anything else we need to know?: latest version metrics server yaml.
Environment:
Kubernetes distribution (GKE, EKS, Kubeadm, the hard way, etc.): Kubeadm on my local servers.
Container Network Setup (flannel, calico, etc.): Calico
Kubernetes version (use
kubectl version
):The text was updated successfully, but these errors were encountered: