开发者社区> 问答> 正文

Prometheus监控没有cadvisor指标数据

已解决

Prometheus监控没有cadvisor指标数据

展开
收起
提个问题 2024-06-16 10:04:53 93 0
1 条回答
写回答
取消 提交回答
  • 开发者社区问答官方账号
    官方回答
    采纳回答
    如果是自建集群,接入容器服务成为注册集群。
    没有采集到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
    2024-06-16 10:04:55
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
MongoDB在性能监控领域的应用 立即下载
构建微服务下的性能监控 立即下载
微服务架构的应用性能监控 立即下载