Skip to content

Instantly share code, notes, and snippets.

@itsprdp
Created February 2, 2016 10:42
Show Gist options
  • Save itsprdp/2a2dff983720a8479207 to your computer and use it in GitHub Desktop.
Save itsprdp/2a2dff983720a8479207 to your computer and use it in GitHub Desktop.
Mount Persistent Disk to a container
kind: Pod
apiVersion: v1
metadata:
name: readonly-pod
spec:
containers:
- name: readonly-pod
image: nginx
volumeMounts:
- mountPath: /etc/secrets
name: secret-files
readOnly: true
volumes:
- name: secret-files
gcePersistentDisk:
pdName: secret-files
fsType: ext4
readOnly: true # Disable this for the first time to write data to the volume
@itsprdp
Copy link
Author

itsprdp commented Feb 2, 2016

I have a use case where the file(secret file) has to be shared between multiple containers across pods.
I was wondering if I can use the persistent volume and mount it on the containers as a ReadOnly accessMode. How do I transfer the file? Do I have to mount this volume on a dummy pod with ReadWriteMany accessMode, transfer the file and then destroy the pod? And I'll have to do this every time I have to update the file on the volume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment