kubernetes-sigs / prometheus-adapter

An implementation of the custom.metrics.k8s.io API using Prometheus
Apache License 2.0
1.9k stars 551 forks source link

Error while disabling TLS in server, setting secure-port = 0 throws error #637

Open cerberus20 opened 7 months ago

cerberus20 commented 7 months ago

What happened?: We are trying to disable TLS on prom-adapter server so that it listens on plaintext http port. We want istio sidecar to manage TLS. But when settting secure-port=0, we get error:

F0124 08:10:49.144671 1 config.go:541] cannot derive external address port without listening on a secure port.

What did you expect to happen?: We expected that setting secure-port = 0 will disable TLS on prom adapter server. As per documentation, --secure-port int The port on which to serve HTTPS with authentication and authorization. If 0, don't serve HTTPS at all. (default 443)

Please provide the prometheus-adapter config:

prometheus-adapter config - args: - --secure-port=0 - --logtostderr=true - --log_dir=/home/sfdc - --log_file=adapter.log - --prometheus-url=http://localhost:20001 - --prometheus-verb=POST - --metrics-relist-interval=1m - --v=20 - --config=/etc/adapter/config.yaml - --metrics-max-age=15m

Please provide the HPA resource used for autoscaling:

HPA yaml

Please provide the HPA status:

Please provide the prometheus-adapter logs with -v=6 around the time the issue happened:

prometheus-adapter logs │ I0124 08:10:49.144412 1 requestheader_controller.go:244] Loaded a new request header values for RequestHeaderAuthRequestController │ │ F0124 08:10:49.144671 1 config.go:541] cannot derive external address port without listening on a secure port.

Anything else we need to know?:

Environment:

cerberus20 commented 7 months ago

Hi @dgrisonnet , can you please help here? Thank you

dgrisonnet commented 7 months ago

/triage accepted /assign

osca-mwongera commented 4 months ago

Hello, I encountered the same issue. I am deploying the registry.k8s.io/prometheus-adapter/prometheus-adapter:v0.11.2 image without TLS certificates on Kubernetes.