Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleCreate the PVC
collapsetrue
$ k apply -f test-claim.yaml -n nfs-test

# The PVC is in pending state
$ k get pvc -n nfs-test
NAME         STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
test-claim   Pending                                      nfs-sc         60s

# Create the folder and a test file inside it
$ mkdir <exported_path>/nfs-test-test-claim
$ touch echo "test" > <exported_path>/nfs-test-test-claim/file_test.txt

# PVC is in bound state now
$ k get pvc -n nfs-test
NAME                               STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/test-claim   Bound    pvc-10663683-eece-46ca-b83d-53f88a1cabc9   5Mi        ROX            nfs-sc         4m3s

...

Create the Pods and verify that the volume is properly mounted within them

Code Block
languagebash
titleCreate and verify the app
collapsetrue
$ k apply -f trial_app.yaml -n nfs-test

# Enter one of the created replicas
$ k exec -it -n nfs-test mystate-0 -- bash

# Check the contents and permissions of the folder on which the volume is mounted
root@mystate-0:/# cat /usr/share/nginx/html/file_test.txt
test
root@mystate-0:/# echo "test2" > /usr/share/nginx/html/file_test.txt
bash: /usr/share/nginx/html/file_test.txt: Read-only file system