Skip to content

Instantly share code, notes, and snippets.

@matthewpalmer
Created October 22, 2018 00:40
Show Gist options
  • Save matthewpalmer/47b14b7f771807b65e69c7f80f693460 to your computer and use it in GitHub Desktop.
Save matthewpalmer/47b14b7f771807b65e69c7f80f693460 to your computer and use it in GitHub Desktop.
Kubernetes NFS server
# Note - an NFS server isn't really a Kubernetes
# concept. We're just creating it in Kubernetes
# for illustration and convenience. In practice,
# it might be run in some other system.
# Create a service to expose the NFS server
# to pods inside the cluster.
kind: Service
apiVersion: v1
metadata:
name: nfs-service
spec:
selector:
role: nfs
ports:
# Open the ports required by the NFS server
# Port 2049 for TCP
- name: tcp-2049
port: 2049
protocol: TCP
# Port 111 for UDP
- name: udp-111
port: 111
protocol: UDP
---
# Run the NFS server image in a pod that is
# exposed by the service.
kind: Pod
apiVersion: v1
metadata:
name: nfs-server-pod
labels:
role: nfs
spec:
containers:
- name: nfs-server-container
image: cpuguy83/nfs-server
securityContext:
privileged: true
args:
# Pass the paths to share to the Docker image
- /exports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment