如果是自建集群,接入容器服务成为注册集群。
没有采集到cadvisor指标数据,原因是自建K8S集群默认没有打开10255端口,通过10250鉴权安全端口采集集群数据。
配置个ServiceMonitor yaml配置文件到集群中,添加后重启kubectl -n arms-prom rollout restart deploy arms-prometheus-ack-arms-prometheus
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
annotations:
arms.prometheus.io/discovery: 'true'
name: arms-prom-cadvisor-10250
namespace: arms-prom
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
honorLabels: true
port: https-metrics
relabelings:
- sourceLabels:
- __metrics_path__
targetLabel: metrics_path
scheme: https
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecureSkipVerify: true
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
honorLabels: true
path: /metrics/cadvisor
port: https-metrics
relabelings:
- sourceLabels:
- __metrics_path__
targetLabel: metrics_path
scheme: https
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecureSkipVerify: true
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
honorLabels: true
path: /metrics/probes
port: https-metrics
relabelings:
- sourceLabels:
- __metrics_path__
targetLabel: metrics_path
scheme: https
tlsConfig:
caFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecureSkipVerify: true
jobLabel: k8s-app
namespaceSelector:
matchNames:
- kube-system
selector:
matchLabels:
k8s-app: kubelet