I have a persistent volume that has read/write access on one specific node.
How can I mount this persistent volume on all other nodes as read only?
Here is what I was thinking, in my pvc.yaml:
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
# This name uniquely identifies the PVC. This is used in deployment.
name: public-pv-claim
namespace: default
spec:
accessModes:
- ReadWriteOnce
- ReadOnlyMany
resources:
# This is the request for storage. Should be available in the cluster.
requests:
storage: 1Gi
and in the specific node
...
volumes:
- name: public
# This volume is based on PVC
persistentVolumeClaim:
# Name of the PVC created earlier
claimName: public-pv-claim
containers:
- name: specific
# Volume mounts for this container
volumeMounts:
# Volume 'public' is mounted to path '/public'
- name: data
mountPath: "/public"
...
and for pods of other nodes:
...
volumes:
- name: public
# This volume is based on PVC
persistentVolumeClaim:
# Name of the PVC created earlier
claimName: public-pv-claim
containers:
- name: other
...
volumeMounts:
- name: public
mountPath: "/public"
readOnly: true
...