tidb-operator icon indicating copy to clipboard operation
tidb-operator copied to clipboard

Persist the prometheus-rules directory in initialization configuration of TM

Open wxiaoke opened this issue 2 years ago • 3 comments

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

wxiaoke avatar Apr 20 '22 03:04 wxiaoke

WDYT @mikechengwei

KanShiori avatar Apr 21 '22 02:04 KanShiori

@wxiaoke Does https://docs.pingcap.com/tidb-in-kubernetes/dev/monitor-a-tidb-cluster#use-a-customized-configuration-file this work for you?

DanielZhangQD avatar Jul 04 '22 08:07 DanielZhangQD

NO,The following step is working. 使用 pvc 持久化步骤更新:

  1. 需要创建一个 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
  1. 然后更改 tidb-monitor 配置
  additionalVolumes:
  - name: pro-rules
    persistentVolumeClaim:
      claimName: pro-rules
  prometheus:
    additionalVolumeMounts:
    - name: pro-rules
      mountPath: "/prometheus-rules/rules/"
  1. 创建 tm 并观察挂载情况 origin_img_v2_d799fdcc-d683-4326-9e60-0985f7b627ag

wxiaoke avatar Aug 16 '22 07:08 wxiaoke