AKS - Existing PVC to be deleted or not

Girish Prajwal 706 Reputation points
2020-10-21T09:13:45.757+00:00

Hi Team,

In my previous question on creating namespace, I had a continued query on the AKS topic.

I was said, that the existing PVC has to be deleted. In that case, does it affect the existing namespace and its deployment or anything disaster could happen.

If we have to remove existing PVC, what happens to the existing Namespace and its PV & PVC. Will the existing namespace and its containers, repositories continue to work normally as expected. Do we have any inter links between these resources.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,900 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 18,637 Reputation points Microsoft Employee
    2020-10-22T02:08:34.547+00:00

    There are a few things to keep in mind:

    1. PersistentVolumeClaims are namespaced objects (specific to a namespace) while PersistentVolumes are not.
    2. 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.
    3. 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.

    0 comments No comments