<p>I have a persistent volume defined as</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ghost-cms-content
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: do-block-storage
</code></pre>
<p>and a deployment defined as</p>
<pre><code>---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: ghost-cms
spec:
  replicas: 4
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  selector:
    matchLabels:
      app: ghost-cms
      tier: frontend
  template:
    metadata:
      labels:
        app: ghost-cms
        tier: frontend
    spec:
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: topology.kubernetes.io/region
          whenUnsatisfiable: ScheduleAnyway
          labelSelector:
            matchLabels:
              app: ghost-cms
              tier: frontend
      containers:
        - name: ghost-cms
          image: ghost:4.6-alpine
          imagePullPolicy: Always
          ports:
            - containerPort: 2368
          volumeMounts:
            - mountPath: /var/lib/ghost/content
              name: content
          env:
            - name: url
              value: https://ghost.site
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 250m
              memory: 256Mi
      volumes:
        - name: content
          persistentVolumeClaim:
            claimName: ghost-cms-content
</code></pre>
<p>but each replica appears to have a unique volume that is not shared with the rest of the replicas. For instance, when I create a text file inside <code>/var/lib/ghost/content</code> in one of the pods, I don't see it in the volume of the other pods. What am I doing wrong?</p>

FrancisV
<p>PVC with permission</p>
<pre><code>accessModes:
  - ReadWriteOnce
</code></pre>
<p>Each pod will get the one volume or PVC, as it's readwrite once.</p>
<p>If you want to keep shared volume across replicas you can use the <strong>NFS</strong> with <strong>accessMode</strong> <strong>ReadWriteMany</strong></p>
<pre><code> accessModes:
      - ReadWriteMany
</code></pre>
<p>Read more at : <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes</a></p>
<p>Example : <a href="https://medium.com/asl19-developers/create-readwritemany-persistentvolumeclaims-on-your-kubernetes-cluster-3a8db51f98e3" rel="nofollow noreferrer">https://medium.com/asl19-developers/create-readwritemany-persistentvolumeclaims-on-your-kubernetes-cluster-3a8db51f98e3</a></p>
<p>You can also use <strong>Minio</strong>, <strong>GlusterFS</strong> to creeat the <strong>NFS</strong> or any managed service like <strong>GCP filestore</strong> providing <strong>NFS</strong> and attach that to POD.</p>
<p>GKE example : <a href="https://medium.com/@Sushil_Kumar/readwritemany-persistent-volumes-in-google-kubernetes-engine-a0b93e203180" rel="nofollow noreferrer">https://medium.com/@Sushil_Kumar/readwritemany-persistent-volumes-in-google-kubernetes-engine-a0b93e203180</a></p>
