kube-promethues添加自定义指标
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