Can I use one pod as ReadWriteOnce and a 2nd as readOnly

Hi,
I created a pvc for Longhorn with ReadWriteOnce.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: rclone-pvc
  namespace: may-la
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn-crypto-global
  resources:
    requests:
      storage: 1Gi

Then I have 2 pods:

1st pod: uses the pvc “normaly” to write to it.

2ns pod: mounts it read only:

        volumeMounts:
        - name: rclone-data
          mountPath: /usr/share/nginx
          readOnly: true
      volumes:
      - name: rclone-data
        persistentVolumeClaim:
          claimName: rclone-pvc

Does that work with Longhorn? Is it the right way to do?

It may work but is not recommended. With this config, the volume is more like a Read-Many volume, which is not officially supported by Longhorn.

Ok. Thanks.
How would you suggest could I implement this use-case:

One pod is receiving files with WebDAV and a 2nd pod is serving the files with nginx.

Thanks
Philip

If the 2 pods are on different nodes, you need to use a RWX Longhorn volume instead.
If the 2 pods are on the same node, probably your current config is fine. Longhorn does not explicitly claim this kind of use case but it does work.