Server gave HTTP response to HTTPS client

2,451 views
Skip to first unread message

akaas...@gmail.com

unread,
Dec 13, 2017, 4:36:45 PM12/13/17
to Prometheus Users

I am trying to setup prometheus to monitor nodes, services and endpoints for my kubernetes cluster [1 master, 7 minions ] . For that I have a very basic promethus.yml file :

scrape_configs:
- job_name: 'kubernetes-pods'
  tls_config:
    insecure_skip_verify: true
  kubernetes_sd_configs:
  - role: pod

Before starting the Prometheus application , I ran the below 2 commands :

export KUBERNETES_SERVICE_HOST=172.9.25.6
export KUBERNETES_SERVICE_PORT=8080

I can access the Kubernetes API server using http://172.9.25.6:8080

The connect is formed over http and NOT https.

Now when I start the application, I get the below ERROR :

level=info ts=2017-12-13T20:39:05.312987614Z caller=kubernetes.go:100 component="target manager" discovery=k8s msg="Using pod service account via in-cluster config"
level=info ts=2017-12-13T20:39:05.313443232Z caller=main.go:371 msg="Server is ready to receive requests."
level=error ts=2017-12-13T20:39:05.316618074Z caller=main.go:211 component=k8s_client_runtime err="github.com/prometheus/prometheus/discovery/kubernetes/kubernetes.go:205: Failed to list *v1.Pod: Get https://172.9.25.6:8080/api/v1/pods?resourceVersion=0: http: server gave HTTP response to HTTPS client"

I also tried to add scheme: http to my prometheus.yml config but it does not work. How can I configure the client to accept HTTP responses ?

Simon Pasquier

unread,
Dec 14, 2017, 2:54:57 AM12/14/17
to akaas...@gmail.com, Prometheus Users
Quickly looking at the k8s client code, it always assumes "https://" for in-cluster configurations. My bet is that you have to define the API address using the "api_server" parameter in the k8s SD configuration.
HTH
Simon

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/bc705548-7419-43fa-bdbe-b963e244e235%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages