Created
September 30, 2018 07:50
-
-
Save linnil1/b712a9f3705f708e1859a0af9e873ae6 to your computer and use it in GitHub Desktop.
NFS persistentVolume with external-storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/nfs/deploy/kubernetes/class.yaml b/nfs/deploy/kubernetes/class.yaml | |
index 6ea74350..9aad3ec4 100644 | |
--- a/nfs/deploy/kubernetes/class.yaml | |
+++ b/nfs/deploy/kubernetes/class.yaml | |
@@ -1,7 +1,7 @@ | |
kind: StorageClass | |
apiVersion: storage.k8s.io/v1 | |
metadata: | |
- name: example-nfs | |
-provisioner: example.com/nfs | |
+ name: nfs | |
+provisioner: external.storage/nfs | |
parameters: | |
mountOptions: "vers=4.1" # TODO: reconcile with StorageClass.mountOptions | |
diff --git a/nfs/deploy/kubernetes/deployment.yaml b/nfs/deploy/kubernetes/deployment.yaml | |
index 4c1099bd..de4a496e 100644 | |
--- a/nfs/deploy/kubernetes/deployment.yaml | |
+++ b/nfs/deploy/kubernetes/deployment.yaml | |
@@ -59,7 +59,7 @@ spec: | |
- DAC_READ_SEARCH | |
- SYS_RESOURCE | |
args: | |
- - "-provisioner=example.com/nfs" | |
+ - "-provisioner=external.storage/nfs" | |
env: | |
- name: POD_IP | |
valueFrom: | |
@@ -78,4 +78,4 @@ spec: | |
volumes: | |
- name: export-volume | |
hostPath: | |
- path: /srv | |
+ path: /tmp/nfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: nfs-nas | |
spec: | |
persistentVolumeReclaimPolicy: Delete | |
capacity: | |
storage: 10Gi | |
accessModes: | |
- ReadWriteMany | |
nfs: | |
server: 192.168.1.3 | |
path: "/nas/dir" | |
--- | |
kind: StorageClass | |
apiVersion: storage.k8s.io/v1 | |
metadata: | |
name: nfs | |
provisioner: external.storage/nfs | |
parameters: | |
mountOptions: "vers=4.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: nfs-pvc | |
annotations: | |
volume.beta.kubernetes.io/storage-class: "nfs" | |
spec: | |
accessModes: | |
- ReadWriteMany | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: test | |
spec: | |
containers: | |
- name: test | |
image: nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04 | |
command: ["tail"] | |
args: ["-f", "/dev/null"] | |
volumeMounts: | |
- name: my-pvc-nfs | |
mountPath: "/nfs" | |
volumes: | |
- name: my-pvc-nfs | |
persistentVolumeClaim: | |
claimName: nfs-pvc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment