kopf icon indicating copy to clipboard operation
kopf copied to clipboard

How to avoid Errors accessing metrics API and CRDs

Open tmmorin opened this issue 10 months ago • 1 comments

Long story short

I'm writing a small controller with no CRD associated that only reacts to changes on Nodes and Pods.

For reasons unrelated to this issue (which I'm solving separately) I see this kind of errors on startup:

[2024-04-15 13:25:28,246] kopf._core.reactor.o [ERROR   ] Request attempt #1/9 failed; will retry: GET https://100.73.0.1:443/apis/metrics.k8s.io/v1beta1 -> APIServerError(None, None)                                                           
[2024-04-15 13:25:29,252] kopf._core.reactor.o [ERROR   ] Request attempt #2/9 failed; will retry: GET https://100.73.0.1:443/apis/metrics.k8s.io/v1beta1 -> APIServerError(None, None)  

And, similarly:

[2024-04-15 13:26:33,105] kopf._core.reactor.o [ERROR   ] Request attempt #1/9 failed; will retry: GET https://100.73.0.1:443/apis/metallb.io/v1beta1 -> ClientConnectorError(ConnectionKey(host='100.73.0.1', port=443, is_ssl=True, ssl=True, pr
oxy=None, proxy_auth=None, proxy_headers_hash=-7154211259067671165), OSError(113, "Connect call failed ('100.73.0.1', 443)"))                                                                                                                                                                                     
[2024-04-15 13:26:33,106] kopf._core.reactor.o [ERROR   ] Request attempt #1/9 failed; will retry: GET https://100.73.0.1:443/apis/ipam.cluster.x-k8s.io/v1alpha1 -> ClientConnectorError(ConnectionKey(host='100.73.0.1', port=443, is_ssl=True, 
ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=-7154211259067671165), OSError(113, "Connect call failed ('100.73.0.1', 443)"))    

At some point Kopf framework abandons...

My question is the following: **given that my controller does not do anything with the metrics API or with CRDs, could I configure Kopf so that it would not try to fetch all of this ?

Kopf version

1.37.2

Kubernetes version

1.28.8

Python version

3.12

Code

No response

Logs

No response

Additional information

No response

tmmorin avatar Apr 15 '24 13:04 tmmorin

You could just deploy the metrics server on your cluster to see if that solves your problem. It's lightweight. https://github.com/kubernetes-sigs/metrics-server

fk128 avatar Apr 27 '24 06:04 fk128