调整kubernetes部署的prometheus数据存储时间

由于prometheus是用kuberentes部署的,没办法像传统部署方式那种直接在启动参数增加存储时间的参数。需要在configmap里或者在deployment里添加,我这里使用的方式是在deployement里添加调整存储时间的参数。

执行kubectl -n prometheus edit deployment prometheus命令直接修改deployement文件
添加如下参数:

spec:
  containers:
  - args:
    - --storage.tsdb.retention.time=365d
    - --config.file=/etc/prometheus/prometheus.yml  # 需要指定配置文件的位置,不然会到当前目录下寻找prometheus.yml文件

添加完参数以后,登录prometheus页面查看prometheus的状态信息,可以看到存储的时间已经变成1年了。

在这里插入图片描述

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐