prometheus-additional.yaml

  - job_name: "docker"
    static_configs:
      - targets: ["10.0.0.142:9323"]
  - job_name: "redis_exporter" 
    scrape_interval: 5s 
    static_configs: 
    - targets: ['redis_exporter:9121'] 
      labels: 
        operator: 'aliyun' 
        area: "bj" 
        env: 'prod' 

Prometheus crd:

kubectl -n kuboard get Prometheus k8s -o yaml > k8s.yaml
vim k8s.yaml
podMonitorNamespaceSelector: {}
podMonitorSelector: {}
//添加以下三行
additionalScrapeConfigs:      
  name: additional-scrape-configs
  key: prometheus-additional.yaml
kubectl -n kuboard apply -f k8s.yaml

secret:

kubectl -n kuboard delete secret additional-scrape-configs
kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml -n kuboard

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code