使用自签名ssl证书为prometheus提供openHttps



尝试为prometheus启动SSL(通过docker启动)。我自己使用open ssl生成密钥和crt。Pair: key和crt工作正常。当我在主机上执行以下命令时:

openssl s_server -cert prometheus.crt -key prometheus.key

显示"ACCEPT">

这是我的Dockerfile for prometheus容器:
https://pastebin.com/4wGtCGp6
当我构建映像并启动它时,它说:
level=error ts= 20121-09-24t20:44:11.649 z caller=stdlib。go:105 component=web caller="http: TLS握手错误来自127.0.0.1:50458"Msg ="远程错误:tls:坏证书"кричитпостоянно

在网上。我通过以下方式配置SSL:

tls_server_config:
cert_file: /etc/prometheus/prometheus.crt
key_file: /etc/prometheus/prometheus.key

在普罗米修斯。我通过以下方式配置SSL:

scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
scheme: https
tls_config:
ca_file: /etc/prometheus/prometheus.crt
cert_file: /etc/prometheus/prometheus.crt
key_file: /etc/prometheus/prometheus.key

这个错误的原因是什么?

如果它是自签名的,则不需要CA文件,因此请尝试删除tls_config中的该行并重新启动容器。

我知道这是一个古老的问题,所以如果回答一个古老的问题是不好的道歉。请随意删除。

最新更新