I’m trying to scrape the services published by Ingress.
kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
myhttp myservice.local 10.195.75.141 80 17h
But Prometheus returns “server returned HTTP status 503 Service Temporarily Unavailable”.
I can fetch metrics from “http://myservice.local/metrics” with curl command.
It is caused that Prometheus adds “:80” to Host header automatically.
The ingress controller in my environment can’t strip “:80”, so I can’t scrape it.
Could anyone please give me some advise?
what is the prometeus config you are using to scrape that ingress?
if that curl works, maybe you need to replace whatever you are using with a static_configs: ,as most of the other resolve the dns and use the IP and static use the dns directly
Thank you for the reply.
To simplify the issue, I described it as Metrics, but it is actually Federation setting.
The following are the settings to scrape.
- job_name: 'JOB'
scrape_interval: 60s
static_configs:
- targets: ['myservice.local']
honor_labels: true
metrics_path: '/federate'
params:
'match[]':
- '{__name__=~".+"}'
I checked the source code, and it looks like giving “:80” is inevitable.
It would be great if you could give me an example of what kind of static_config would solve this.