apiVersion: v1 kind: Service metadata: name: nfs-server spec: clusterIP: {{ nfsserver.ip }} clusterIPs: - {{ nfsserver.ip }} ports: - name: 111-tcp port: 111 protocol: TCP targetPort: 111 - name: 111-udp port: 111 protocol: UDP targetPort: 111 - name: 2049-tcp port: 2049 protocol: TCP targetPort: 2049 - name: 2049-udp port: 2049 protocol: UDP targetPort: 2049 - name: 32765-udp port: 32765 protocol: UDP targetPort: 32765 - name: 32765-tcp port: 32765 protocol: TCP targetPort: 32765 selector: role: nfs-server sessionAffinity: None type: ClusterIP --- apiVersion: apps/v1 kind: Deployment metadata: name: nfs-server spec: replicas: 1 selector: matchLabels: role: nfs-server template: metadata: labels: role: nfs-server spec: containers: - name: nfs-server image: erichough/nfs-server env: - name: NFS_EXPORT_0 value: '/mnt/stage *(rw,sync,no_subtree_check,fsid=100)' - name: NFS_LOG_LEVEL value: DEBUG # doesn't debug client connections for some reason securityContext: privileged: true volumeMounts: - mountPath: /mnt/stage name: nfs-stage-src - mountPath: /lib/modules # mounting modules into container name: lib-modules readOnly: true # make sure it's readonly volumes: - hostPath: # using hostpath to get modules from the host path: /lib/modules type: Directory name: lib-modules - name: nfs-stage-src emptyDir: {}