Axon Server persistant storage in Minikube

Hi I am having some trouble with getting the persistent storage working on my minikube instant of axon server. Each time I restart minikube the previous events will be gone. Below is my manifest.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: axon-data-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: standard
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: axon-config-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: standard
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: axonserver
  labels:
    app: axonserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: axonserver
  template:
    metadata:
      labels:
        app: axonserver
    spec:
      containers:
        - name: axonserver
          image: axoniq/axonserver:latest
          ports:
            - containerPort: 8024 # HTTP
            - containerPort: 8124 # gRPC
          env:
            - name: AXONSERVER_NAME
              value: "axonserver"
            - name: AXONSERVER_STORAGE
              value: "/data"
            - name: AXONSERVER_CONTROLDB
              value: "/config"
            - name: AXONSERVER_INIT_CLUSTER
              value: "true"
          args:
            - "--name=axonserver"
            - "--storage=/data"
            - "--control-db=/config"
            - "--cluster-initialization=true"
            - "--axoniq.axonserver.standalone=true"
          volumeMounts:
            - name: axon-data
              mountPath: /data
            - name: axon-config
              mountPath: /config
      volumes:
        - name: axon-data
          persistentVolumeClaim:
            claimName: axon-data-pvc
        - name: axon-config
          persistentVolumeClaim:
            claimName: axon-config-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: axonserver
spec:
  type: NodePort
  ports:
    - name: web
      port: 8024
      targetPort: 8024
      nodePort: 30001 # Accessible via Minikube IP
    - name: grpc
      port: 8124
      targetPort: 8124
      nodePort: 30002
  selector:
    app: axonserver
kubectl get pv
kubectl get pvc
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                     STORAGECLASS   VOLUMEATTRIBUTESCLASS   REASON   AGE
pvc-28b14154-7dbb-4817-a4e7-fd591d0a77e6   1Gi        RWO            Delete           Bound    default/mongo-pvc         standard       <unset>                          6d21h
pvc-70a5f15a-fac9-4997-bd15-23306f102e72   5Gi        RWO            Delete           Bound    default/axon-data-pvc     standard       <unset>                          6m46s
pvc-970cbf58-e744-4d35-b926-be73d14a64b0   1Gi        RWO            Delete           Bound    default/axon-config-pvc   standard       <unset>                          6m46s
pvc-ba51b50a-d705-464c-9748-e7ac634a2f3e   1Gi        RWO            Delete           Bound    default/mysql-pvc         standard       <unset>                          6d21h
NAME              STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE
axon-config-pvc   Bound    pvc-970cbf58-e744-4d35-b926-be73d14a64b0   1Gi        RWO            standard       <unset>                 6m46s
axon-data-pvc     Bound    pvc-70a5f15a-fac9-4997-bd15-23306f102e72   5Gi        RWO            standard       <unset>                 6m46s
mongo-pvc         Bound    pvc-28b14154-7dbb-4817-a4e7-fd591d0a77e6   1Gi        RWO            standard       <unset>                 6d21h
mysql-pvc         Bound    pvc-ba51b50a-d705-464c-9748-e7ac634a2f3e   1Gi        RWO            standard       <unset>                 6d21h

Hi,
I’m not an expert in Minikube, but from your pv results, I see “Reclaim Policy: Delete” for all the persistent volumes.

From k8s documentation you need to configure persistentVolumeReclaimPolicy: Retain in your volumes spec block

Here the links to the doc