我正在尝试设置Prometheus来监控我的Kubernetes集群的节点、服务和端点[1主,7从]。为此,我有一个非常基本的promatus.yml文件:
scrape_configs:
- job_name: 'kubernetes-pods'
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- role: pod
在启动普罗米修斯应用程序之前,我运行了以下两个命令:
export KUBERNETES_SERVICE_HOST=172.9.25.6
export KUBERNETES_SERVICE_PORT=8080
我可以使用http://172.9.25.6:8080
访问Kubernetes API服务器
连接是通过http而不是通过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响应?
1条答案
按热度按时间iibxawm41#
尝试在Kubernetes_SD_Configs中指定
api_server
: