$ kubectl create -f nfs-server-vsphere-volume.yaml
storageclass "nfs-server-sc" created
persistentvolumeclaim "nfs-server-pvc" created
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
nfs-server-pvc Bound pvc-048776b4-a447-11e7-ab1f-0050569c67d8 200Gi RWO nfs-server-sc 1m
$ kubectl get pv
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-048776b4-a447-11e7-ab1f-0050569c67d8 200Gi RWO Delete Bound default/nfs-server-pvc nfs-server-sc 1m
$ kubectl create -f nfs-server.yaml
replicationcontroller "nfs-server" created
service "nfs-server" created
$ kubectl get replicationcontroller
NAME DESIRED CURRENT READY AGE
nfs-server 1 1 1 1m
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
nfs-server-b4gbj 1/1 Running 0 1m
$ kubectl describe pod nfs-server-b4gbj | grep Node
Node: kubernetes-node3/10.192.39.148
Node-Selectors: <none>
$ kubectl describe service nfs | grep Endpoints
Endpoints: 172.1.13.3:2049
Endpoints: 172.1.13.3:20048
Endpoints: 172.1.13.3:111
Update Endpoint IP in the nfs-app-data-volume.yaml
and continue provisioning app data volume.
$ kubectl create -f nfs-app-data-volume.yaml
persistentvolume "nfs-data-pv" created
persistentvolumeclaim "nfs-data-pvc" created
$ kubectl get pvc nfs-data-pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
nfs-data-pvc Bound nfs-data-pv 200Gi RWX 1h
$ kubectl get pv nfs-data-pv
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
nfs-data-pv 200Gi RWX Retain Bound default/nfs-data-pvc 1h
$ kubectl create -f app-pods.yaml
pod "app-pod1" created
pod "app-pod2" created
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
app-pod1 1/1 Running 0 47s
app-pod2 1/1 Running 0 46s
nfs-server-b4gbj 1/1 Running 0 18m
$ kubectl describe pod app-pod1 | grep Node
Node: kubernetes-node2/10.192.51.180
Node-Selectors: <none>
divyenp-m01:nfs divyenp$ kubectl describe pod app-pod2 | grep Node
Node: kubernetes-node4/10.192.55.170
Node-Selectors: <none>
$ kubectl exec -it app-pod1 /bin/sh
/ # ls /mnt/data/
app-pod1.txt app-pod2.txt index.html lost+found
/ #