docs: extend PVC test to include pod write + persistence check
Prior test only checked PVC reaches Bound. Add a pod that writes a file, then a second pod re-mounting the same PVC to confirm data survives pod delete/recreate (proves NFS-backed, not emptyDir).
This commit is contained in:
@@ -195,9 +195,65 @@ EOF
|
||||
kubectl get pvc nfs-test
|
||||
```
|
||||
|
||||
Status should be `Bound`. Clean up:
|
||||
Status should be `Bound`.
|
||||
|
||||
Test a pod actually writing to it:
|
||||
|
||||
```bash
|
||||
kubectl apply -f - <<'EOF'
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: nfs-test-pod
|
||||
namespace: default
|
||||
spec:
|
||||
containers:
|
||||
- name: writer
|
||||
image: busybox:1.36
|
||||
command: ["sh", "-c", "echo hello-from-$(hostname)-$(date -u +%FT%TZ) > /data/test.txt && sleep 3600"]
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: nfs-test
|
||||
EOF
|
||||
kubectl wait --for=condition=Ready pod/nfs-test-pod --timeout=60s
|
||||
kubectl exec nfs-test-pod -- cat /data/test.txt
|
||||
```
|
||||
|
||||
Verify data persists across pod delete/recreate (proves it's NFS-backed, not local emptyDir):
|
||||
|
||||
```bash
|
||||
kubectl delete pod nfs-test-pod
|
||||
kubectl apply -f - <<'EOF'
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: nfs-test-pod2
|
||||
namespace: default
|
||||
spec:
|
||||
containers:
|
||||
- name: reader
|
||||
image: busybox:1.36
|
||||
command: ["sleep", "3600"]
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: nfs-test
|
||||
EOF
|
||||
kubectl wait --for=condition=Ready pod/nfs-test-pod2 --timeout=60s
|
||||
kubectl exec nfs-test-pod2 -- cat /data/test.txt # same content, different pod
|
||||
```
|
||||
|
||||
Clean up:
|
||||
|
||||
```bash
|
||||
kubectl delete pod nfs-test-pod2
|
||||
kubectl delete pvc nfs-test
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user