Skip to content

Instantly share code, notes, and snippets.

@matthewpalmer
Created October 22, 2018 00:57
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save matthewpalmer/60118e00e559692eb93a2ccf2be5e32a to your computer and use it in GitHub Desktop.
Save matthewpalmer/60118e00e559692eb93a2ccf2be5e32a to your computer and use it in GitHub Desktop.
Example for using NFS volume in pod
# Create a pod that reads and writes to the
# NFS server via an NFS volume.
kind: Pod
apiVersion: v1
metadata:
name: pod-using-nfs
spec:
# Add the server as an NFS volume for the pod
volumes:
- name: nfs-volume
nfs:
# URL for the NFS server
server: 10.108.211.244 # Change this!
path: /
# In this container, we'll mount the NFS volume
# and write the date to a file inside it.
containers:
- name: app
image: alpine
# Mount the NFS volume in the container
volumeMounts:
- name: nfs-volume
mountPath: /var/nfs
# Write to a file inside our NFS
command: ["/bin/sh"]
args: ["-c", "while true; do date >> /var/nfs/dates.txt; sleep 5; done"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment