Skip to content

PV/PVC not persistent across system and application restart? #5092

Open
@khteh

Description

@khteh

I have a PostgreSQL single-replica application running on my local microk8s. It has the following PVC:

          volumeMounts:
            - name: postgresql-persistent-storage
              mountPath: /var/lib/postgresql
              subPath: postgresql
  volumeClaimTemplates:
    - metadata:
        name: postgresql-persistent-storage
      spec:
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: 10Gi

PVC:

postgresql-persistent-storage-postgresql-0   Bound    pvc-373b6765-599e-4177-ae76-097b56911dbd   10Gi       RWO            microk8s-hostpath   35d

PV:

pvc-373b6765-599e-4177-ae76-097b56911dbd   10Gi       RWO            Delete           Bound    default/postgresql-persistent-storage-postgresql-0   microk8s-hostpath            36d

I find out that everytime when my laptop reboots and the application restarts automatically, the tables are empty that I have to reload the data. This contradicts with my understanding that the PV/PVC which has physical SSD storage is persistent storage and shouldn't be cleared by system / application restart unless intentionally done so by the application itself? What do I miss?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions