关于命令行修改K8s内Prometheus配置文件参数

#登录master节点操作

1、进入prometheus介质目录:

[root@k8s-master01]$ cd /yang/operator/operator-0.7/manifests/prometheus

2、备份prometheus配置文件

[root@k8s-master01]$cp prometheus-prometheus.yaml prometheus-prometheus.yaml.20231215

3、编辑prometheus配置文件修改相关参数

scrapeInterval: 30s

scrapeTimeout: 30s

evaluationInterval: 30s

4、更新prometheus配置

[root@k8s-master01]$ kubectl apply -f prometheus-prometheus.yaml

5、重启prometheus加载配置文件

[root@k8s-master01]$ kubectl rollout restart sts prometheus-k8s -n monitoring

6、检查prometheus的pod状态

kubectl -n monitoring get pod

7、检查配置是否生效

访问prometheus WEB界面点击“Status”--->“Configuration”,查看配置是否生效

posted @ 2024-01-16 16:03  呼长喜  阅读(82)  评论(0编辑  收藏  举报