seedbox-nfs.yaml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ---
  2. apiVersion: v1
  3. kind: Namespace
  4. metadata:
  5. name: nfs
  6. ---
  7. apiVersion: apps/v1
  8. kind: Deployment
  9. metadata:
  10. name: nfs-seedbox
  11. namespace: nfs
  12. spec:
  13. strategy:
  14. type: Recreate
  15. selector:
  16. matchLabels:
  17. app: nfs-seedbox
  18. replicas: 1
  19. template:
  20. metadata:
  21. labels:
  22. app: nfs-seedbox
  23. annotations:
  24. backup.velero.io/backup-volumes-excludes: data
  25. spec:
  26. affinity:
  27. nodeAffinity:
  28. requiredDuringSchedulingIgnoredDuringExecution:
  29. nodeSelectorTerms:
  30. - matchExpressions:
  31. - key: seedbox
  32. operator: In
  33. values:
  34. - "true"
  35. tolerations:
  36. - key: seedbox
  37. operator: Equal
  38. value: "true"
  39. effect: NoSchedule
  40. hostNetwork: true
  41. containers:
  42. - name: nfs
  43. image: erichough/nfs-server:2.2.1
  44. ports:
  45. - containerPort: 2049
  46. name: nfs
  47. securityContext:
  48. privileged: true
  49. volumeMounts:
  50. - mountPath: "/data"
  51. name: data
  52. - mountPath: /etc/exports
  53. name: exports
  54. subPath: exports
  55. readOnly: true
  56. volumes:
  57. - name: data
  58. hostPath:
  59. path: /mnt/data
  60. type: Directory
  61. - name: exports
  62. configMap:
  63. name: seedbox-nfs-exports
  64. items:
  65. - key: exports
  66. path: exports
  67. ---
  68. apiVersion: v1
  69. kind: ConfigMap
  70. metadata:
  71. name: seedbox-nfs-exports
  72. namespace: nfs
  73. data:
  74. exports: |
  75. /data 172.16.69.30(rw) 172.16.69.31(rw) 172.16.69.32(rw) 172.16.69.52(rw) 172.16.69.253(rw) 10.42.0.0/16(rw)
  76. # Testing NFS access from within a pod
  77. # ---
  78. # apiVersion: v1
  79. # kind: Pod
  80. # metadata:
  81. # name: test-pd-2
  82. # namespace: nfs
  83. # spec:
  84. # containers:
  85. # - image: nginx:1.25.1
  86. # name: test-container
  87. # volumeMounts:
  88. # - mountPath: /my-nfs-data
  89. # name: test-volume
  90. # volumes:
  91. # - name: test-volume
  92. # nfs:
  93. # server: 172.16.69.52
  94. # path: /data