Shared NFS and SubPaths in Kubernetes

apiVersion: v1
kind: PersistentVolume
metadata:
name: kube-storage-nfs
labels:
bucket: shared
spec:
capacity:
storage: 30T
volumeMode: Filesystem
storageClassName: slow
persistentVolumeReclaimPolicy: Retain
accessModes:
— ReadWriteMany
nfs:
server: <nfs_server_ip_addr>
path: “/path/to/kube-storage”
readOnly: false
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shared-data
spec:
accessModes:
— ReadWriteMany
storageClassName: slow
resources:
requests:
storage: 30T
selector:
matchLabels:
bucket: shared
kubectl apply -f kube-storage-pv.yaml
kubectl apply -f kube-storage-pvc.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: myApp-deploy
labels:
app: myApp
spec:
template:
metadata:
labels:
app: myApp
spec:
containers:

volumeMounts:
— name: myApp-storage
mountPath: /path/to/data
subPath: myApp
volumes:
— name: myApp-storage
persistentVolumeClaim:
claimName: shared-data

--

--

I'm an engineering leader who is passionate about reliability engineering and building sustainable/scalable teams.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Joseph Bironas

Joseph Bironas

I'm an engineering leader who is passionate about reliability engineering and building sustainable/scalable teams.