【发布时间】:2019-10-22 11:27:42
【问题描述】:
- 我们有 kubernetes 集群,其中我有服务帐户“kube”,命名空间“monitoring”,并创建了集群角色绑定来监控集群
- 我们在集群外部的 linux 系统(本地)上安装了 prometheus,并使用“root”进行安装
- 当我尝试使用
ca.crt和用户token(由 kubernetes 管理员提供)通过 https api 连接到 k8 集群时,它会引发多个错误。
错误信息:
component="discovery manager scrape" msg="Cannot create service discovery" err="unable to use specified CA cert /root/prometheus/ca.crt" type=*kubernetes.SDConfig
component="discovery manager scrape" msg="Cannot create service discovery" err="unable to use specified CA cert /root/prometheus/ca.crt" type=*kubernetes.SDConfig
普罗米修斯配置:
- job_name: 'kubernetes-apiservers'
scheme: https
tls_config:
ca_file: /root/prometheus/ca.crt
bearer_token_file: /root/prometheus/user_token
kubernetes_sd_configs:
- role: endpoints
api_server: https://example.com:1234
bearer_token_file: /root/prometheus/user_token
tls_config:
ca_file: /root/prometheus/prometheus-2.12.0.linux-amd64/ca.crt
relabel_configs:
- source_labels: [monitoring, monitoring-sa, 6443]
action: keep
regex: default;kubernetes;https
- job_name: 'kubernetes-nodes'
scheme: https
tls_config:
ca_file: /root/prometheus/ca.crt
bearer_token_file: /root/prometheus/user_token
kubernetes_sd_configs:
- role: node
api_server: https://example.com:1234
bearer_token_file: /root/prometheus/user_token
tls_config:
ca_file: /root/prometheus/ca.crt
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- target_label: __address__
replacement: https://example.com:1234
- source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: __metrics_path__
replacement: /api/v1/nodes/${1}/proxy/metrics
【问题讨论】:
-
普罗米修斯的版本是多少?
-
2.12.0 @KamolHasan
-
@KamolHasan 与 2.13.1 相同的错误
标签: kubernetes monitoring prometheus