63 lines
1.5 KiB
YAML
63 lines
1.5 KiB
YAML
|
|
# StorageClass verification — confirms the default StorageClass can provision PVCs.
|
||
|
|
#
|
||
|
|
# K3s default StorageClass: local-path (rancher/local-path-provisioner)
|
||
|
|
# This is adequate for single-node dev/staging; for HA ThreePhoenix, a
|
||
|
|
# distributed StorageClass (Longhorn, Rook-Ceph) is preferred.
|
||
|
|
#
|
||
|
|
# Apply:
|
||
|
|
# kubectl apply -f verify-pvc.yaml
|
||
|
|
#
|
||
|
|
# Verify:
|
||
|
|
# kubectl get pvc -n storage-test
|
||
|
|
# # STATUS=Bound means provisioning works.
|
||
|
|
# kubectl get pod -n storage-test
|
||
|
|
# # pod/storage-test should be Completed (exit 0).
|
||
|
|
#
|
||
|
|
# Clean up:
|
||
|
|
# kubectl delete namespace storage-test
|
||
|
|
|
||
|
|
apiVersion: v1
|
||
|
|
kind: Namespace
|
||
|
|
metadata:
|
||
|
|
name: storage-test
|
||
|
|
---
|
||
|
|
apiVersion: v1
|
||
|
|
kind: PersistentVolumeClaim
|
||
|
|
metadata:
|
||
|
|
name: storage-test-pvc
|
||
|
|
namespace: storage-test
|
||
|
|
spec:
|
||
|
|
accessModes:
|
||
|
|
- ReadWriteOnce
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
storage: 100Mi
|
||
|
|
# Omit storageClassName to use the cluster default.
|
||
|
|
# To test a specific class: storageClassName: local-path
|
||
|
|
---
|
||
|
|
apiVersion: v1
|
||
|
|
kind: Pod
|
||
|
|
metadata:
|
||
|
|
name: storage-test
|
||
|
|
namespace: storage-test
|
||
|
|
spec:
|
||
|
|
restartPolicy: Never
|
||
|
|
containers:
|
||
|
|
- name: writer
|
||
|
|
image: busybox:1.36
|
||
|
|
command:
|
||
|
|
- sh
|
||
|
|
- -c
|
||
|
|
- |
|
||
|
|
echo "StorageClass test: writing file" && \
|
||
|
|
echo "ok" > /data/test.txt && \
|
||
|
|
cat /data/test.txt && \
|
||
|
|
echo "StorageClass verification PASSED"
|
||
|
|
volumeMounts:
|
||
|
|
- name: data
|
||
|
|
mountPath: /data
|
||
|
|
volumes:
|
||
|
|
- name: data
|
||
|
|
persistentVolumeClaim:
|
||
|
|
claimName: storage-test-pvc
|