prometheus operator 配置 config
发表于|更新于
|字数总计:238|阅读时长:1分钟
prometheus operator 自定义 config
链接:prometheus-operator/Documentation/additional-scrape-config.md at · GitHub
prometheus 实例增加如下配置:
spec: additionalScrapeConfigs: name: additional-scrape-configs key: prometheus-additional.yaml
|
prometheus-additional.yaml 配置如下:
- job_name: "prometheus" static_configs: - targets: ["localhost:9090"]
|
kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml --dry-run=client -oyaml > additional-scrape-configs.yaml
kubectl apply -f additional-scrape-configs.yaml -n monitoring
kubectl -n monitoring get secrets additional-scrape-configs -o jsonpath='{.data.prometheus-additional\.yaml}' | base64 -d
|
prometheus operator 配置 remote_write
kubectl -n monitoring edit prometheus k8s
spec: remoteWrite: - url: http://vminsert:8480/insert/0/prometheus/
kubectl -n monitoring get secrets prometheus-k8s -o jsonpath='{.data.prometheus\.yaml\.gz}' | base64 -d | gzip -d
|
prometheus operator 配置 external_labels
kubectl edit prometheus k8s -n monitoring
spec: externalLabels: cluster: "test-1" environment: "production"
|
参考