Reputation: 7012
I have a pod that needs to create a lot of jobs. I'd like to share a read-only folder. How can I do it?
Several ideas I can imagine (I'm newbie to Kubernetes):
kubectl cp
to copy the data between the base pod to the pod in the job.What would be the better solution for this?
Upvotes: 1
Views: 1050
Reputation: 1117
You can use a PersistentVolume
and mount it as read only volume inside the pod via PersistentVolumeClaim
. To mount a read only volume, set .spec.containers[*].volumeMounts[*].readOnly
to true
.
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: myfrontend
image: nginx
volumeMounts:
- mountPath: "/var/www/html"
name: mypd
readOnly: true
volumes:
- name: mypd
persistentVolumeClaim:
claimName: myclaim
Check out these links:
Upvotes: 5