tidb-operator
tidb-operator copied to clipboard
Persist the prometheus-rules directory in initialization configuration of TM
At present, the persistent storage of tm is the data directory in the prometheus container. If the rules of prometheus are manually changed, persistent storage cannot be performed. It is recommended to persist this directory as well.
Whether to consider adding prometheus-rules to the data directory
WDYT @mikechengwei
@wxiaoke Does https://docs.pingcap.com/tidb-in-kubernetes/dev/monitor-a-tidb-cluster#use-a-customized-configuration-file this work for you?
NO,The following step is working. 使用 pvc 持久化步骤更新:
- 需要创建一个 pvc
cat pvc1.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pro-rules
namespace: tidb-cluster
spec:
storageClassName: local-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- 然后更改 tidb-monitor 配置
additionalVolumes:
- name: pro-rules
persistentVolumeClaim:
claimName: pro-rules
prometheus:
additionalVolumeMounts:
- name: pro-rules
mountPath: "/prometheus-rules/rules/"
- 创建 tm 并观察挂载情况