metrics-server request canceled while waiting for connection on Kubernetes

7/1/2019
message: 'no response from https://x.x.x.x:443: Get https://x.x.x.x:443:
      net/http: request canceled while waiting for connection (Client.Timeout exceeded
      while awaiting headers)'

x.x.x.x is my metrics-server svc ip addr (CLusterIP)

Logs from metrics-server pod

I0701 03:33:32.914871       1 serving.go:312] Generated self-signed cert (apiserver.local.config/certificates/apiserver.crt, apiserver.local.config/certificates/apiserver.key)
W0701 03:33:33.359803       1 authentication.go:296] Cluster doesn't provide requestheader-client-ca-file in configmap/extension-apiserver-authentication in kube-system, so request-header client certificate authentication won't work.
I0701 03:33:33.390768       1 manager.go:95] Scraping metrics from 0 sources
I0701 03:33:33.391217       1 manager.go:150] ScrapeMetrics: time: 1.237µs, nodes: 0, pods: 0
I0701 03:33:33.404222       1 secure_serving.go:116] Serving securely on [::]:443

I always use heapster and wanna to replace heapster to metrics-server. The metrics-server source is https://github.com/kubernetes-incubator/metrics-server/tree/master/deploy/1.8%2B

I have read and tried searching in google, but it's unrelated with my logs error.

I expect kubectl top pod or kubectl top node is running very well. However, since i applied metrics-server, i cannot to execute those commands. In the meantime, i deleted metrics-server apiservice and everything is fine. But yeah, i am still using heapster.

Can someone help me to done this or enlight me.

-- Nicky Puff
heapster
kubernetes
metrics

1 Answer

7/2/2019

However if you want to use metrics-server to fix the issue, edit metrics-server-deployment.yaml and add the parameters below right after

image: k8s.gcr.io/metrics-server-amd64:v0.3.1 line:

command:
        - /metrics-server
        - --kubelet-insecure-tls
        - --kubelet-preferred-address-types=InternalIP

then re-apply file using command:

$ kubectl apply -f metrics-server-deployment.yaml

After few seconds, you can get metrics via

$ kubectl get --raw "/apis/metrics.k8s.io/v1beta1/nodes" 

or

$ kubectl top node

commands.

More information you can find here: metrics-server-issue.

-- MaggieO
Source: StackOverflow