A data source is an origin object used to initialize a newly provisioned PersistentVolume. Dynamic provisioning otherwise creates an empty volume, so a data source makes prepopulated read-only storage possible. section 10.2.4
A PersistentVolumeClaim can use another PersistentVolumeClaim as its data source. Set dataSourceRef with kind PersistentVolumeClaim and the source claim’s name; the associated PersistentVolume supplies the initial data. section 10.2.4
Clone a claim for read-only readers
A claim requesting ReadOnlyMany can reference demo-read-write-once through dataSourceRef. Mount the resulting claim with readOnly: true so reader pods see the files copied from the source volume. section 10.2.4
Listing 10.5 Initializing a PersistentVolumeClaim with another PersistentVolumeClaim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: demo-read-only-many
labels:
app: demo-read-only-many
spec:
resources:
requests:
storage: 1Gi
accessModes: #1
- ReadOnlyMany #1
dataSourceRef: #2
kind: PersistentVolumeClaim #2
name: demo-read-write-once #2
Example PersistentVolumeClaim manifest using another PersistentVolumeClaim as its data source. section 10.2.4
Listing 10.6 A pod using a shared PersistentVolume in read-only mode
apiVersion: v1
kind: Pod
metadata:
generateName: demo-read-only-many-
labels:
app: demo-read-only-many
spec:
volumes:
- name: volume
persistentVolumeClaim: #1
claimName: demo-read-only-many #1
readOnly: true #1
containers:
- name: main
image: busybox
command:
- sh
- -c
- |
echo "I can read from the volume; these are its files:" ; #2
ls /mnt/volume ; #2
sleep infinity #2
volumeMounts:
- name: volume
mountPath: /mnt/volume ...
Example pod manifest mounting the initialized claim in read-only mode. section 10.2.4












