我正在尝试设置prometheus来监控我的kubernetes集群[1个主人,7个小兵]的节点,服务和端点。为此,我有一个非常基本的promethus.yml文件:
scrape_configs:
- job_name: 'kubernetes-pods'
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- role: pod
在启动Prometheus应用程序之前,我运行了以下2个命令:
export KUBERNETES_SERVICE_HOST=172.9.25.6
export KUBERNETES_SERVICE_PORT=8080
我可以使用http://172.9.25.6:8080
连接是通过http和NOT https形成的。
现在,当我启动应用程序时,我收到以下错误:
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"
我还尝试将scheme: http
添加到我的prometheus.yml
配置中,但它不起作用。如何配置客户端以接受HTTP响应?