There are a few things to keep in mind:
- PersistentVolumeClaims are namespaced objects (specific to a namespace) while PersistentVolumes are not.
- PVC must be created in the same namespace where the pod is created. The cluster finds the claim in the Pod's namespace and uses it to get the PersistentVolume backing the claim. The volume is then mounted to the host and into the Pod.
- Not All Objects are in a Namespace. Most Kubernetes resources (e.g. pods, services, replication controllers, and others) are in some namespaces. And low-level resources, such as nodes and persistentVolumes, are not in any namespace.
To see which Kubernetes resources are and aren't in a namespace:
In a namespace
kubectl api-resources --namespaced=true
Not in a namespace
kubectl api-resources --namespaced=false
Reference doc: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#not-all-objects-are-in-a-namespace
Are you planning to have multiple namespaces for your AKS cluster? If yes, this document will help you make that decision.
Each Kubernetes resource can only be in one namespace and thus if you plan to have multiple namespaces, you would need to create new PVC for the new namespace.
A Kubernetes namespace provides the scope for Pods, Services, and Deployments in the cluster. The resources users create in one namespace are hidden from the other namespace.