We're Hiring!

Mattermost, Inc.

How do I persist config file in kubernetes

hi, I am trying to deploy MM to a kubernetes cluster. My kubernetes cluster is setup by kubeadm on bare metal, and I am not using any operators or helm.

my yaml file:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mattermost-data
  namespace: devops
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: rook-cephfs

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mattermost
  namespace: devops
spec:
  selector:
    matchLabels:
      app: mattermost
  replicas: 1
  template:
    metadata:
      labels:
        app: mattermost
    spec:
      containers:
        - name: mattermost
          image: mattermost/platform:5.24.2
          ports:
            - containerPort: 8065
              name: default
          volumeMounts:
            - name: data-volume
              mountPath: /mm/mattermost/logs
              subPath: logs
            - name: data-volume
              mountPath: /mm/mattermost-data
              subPath: mattermost-data
            - name: data-volume
              mountPath: /var/lib/mysql
              subPath: mysql-data
      volumes:
        - name: data-volume
          persistentVolumeClaim:
            claimName: mattermost-data

but here is my problem:
I want the config_docker.json also be persisted on PV, but MM in docker seems generate this file at startup, and write back it when change configurations on system console UI.

I can’t use configmap, as configmap is always mounted as readonly, I can’t mount
PV to /mm/mattermost/config, as it will wipe out default config.json file.

any idea ?