Understanding Persistent Volume Namespaces in k3s on Raspberry Pi

Learn about the namespace scoping of Persistent Volume Claims and Persistent Volumes in k3s on Raspberry Pi. This guide will help you understand how they interact within a Kubernetes cluster.
In Kubernetes, Persistent Volume Claims (PVCs) are namespace-scoped, while Persistent Volumes (PVs) are not. This distinction is important for managing storage in your k3s cluster on Raspberry Pi.
Viewing Persistent Volume Claims
PVCs are specific to namespaces. Here’s how to view them:
kubectl get pvcExample output:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
testing-vol-pvc Bound testing-vol-pv 1Gi RWO iscsi 27hTo view PVCs in a specific namespace:
kubectl --namespace docker-registry get pvcExample output:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
docker-registry-pvc Bound docker-registry-pv 1Gi RWO iscsi 23hViewing Persistent Volumes
PVs are not namespace-scoped. Here’s how to view them:
kubectl get pvExample output:
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
testing-vol-pv 1Gi RWO Retain Bound default/testing-vol-pvc iscsi 27h
docker-registry-pv 1Gi RWO Retain Bound docker-registry/docker-registry-pvc iscsi 23hThis distinction between PVCs and PVs is crucial for managing and allocating storage resources within your k3s cluster, ensuring that your applications have access to the necessary storage while maintaining proper namespace isolation.
By following these steps, you can effectively manage and understand the interactions between Persistent Volume Claims and Persistent Volumes in your k3s setup on Raspberry Pi.