我有一个 K8s 集群,它使用 Kubespray 部署在本地服务器上的托管 etcd。我没有看到 Prometheus 操作员抓取 etcd 指标。使用 helm 部署的 Prometheus 操作员v3.5.4
。K8s 版本1.22
,Helm 图表prometheus-community/kube-prometheus-stack
版本25.0.0
,3 节点控制平面上CentOS 7
。
Prometheus 配置显示 etcd 的作业- job_name: serviceMonitor/monitoring/kube-prometheus-kube-prome-kube-etcd/0
。但是 Prometheus 的服务列表中没有 etcd 的服务。
没有为 etcd 定义端点
用于 helm 部署的 Values.yml(使用 volumes 更新)
prometheus:
service:
type: NodePort
externalTrafficPolicy: Local
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: "custom"
hosts:
- prometheus.{{ cluster_domain }}.mydomain.com
paths:
- /
pathType: Prefix
tls:
- secretName:
prometheusSpec:
storageSpec:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: rook-ceph-block
resources:
requests:
storage: {{ monitoring.storage_size }}
volumeMounts:
- name: cert-vol
mountPath: "/etc/prometheus/secrets/etcd-certs"
readOnly: true
volumes:
- name: cert-vol
secret:
secretName: etcd-certs
kubeEtcd:
enabled: true
endpoints:
- 172.1.1.1
- 172.1.1.2
- 172.1.1.3
service:
port: 2379
targetPort: 2379
serviceMonitor:
scheme: https
insecureSkipVerify: true
caFile: /etc/prometheus/secrets/etcd-certs/ca.crt
certFile: /etc/prometheus/secrets/etcd-certs/client.crt
keyFile: /etc/prometheus/secrets/etcd-certs/client.key