question

ShreyasArani-1167 avatar image
0 Votes"
ShreyasArani-1167 asked prmanhas-MSFT answered

Azure managed disks are getting deleted when the AKS instance is deleted

Hi my azure managed disks are getting deleted when I delete my AKS instance because these azure disks are getting created under node resource group of the AKS instance. When I delete my aks instance the node resource group is deleted and all resources like disks etc under this node resource group are getting deleted.
Basically I am using this azure disks as persistance volumes. So I need to retain the disks even if my aks instance is deleted. Is there any way to retain the disks??
Please answer my query.

azure-kubernetes-serviceazure-managed-disks
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

prmanhas-MSFT avatar image
0 Votes"
prmanhas-MSFT answered

@ShreyasArani-1167 Apologies for the delay in response and all the inconvenience caused because of the issue.

If these are dynamic PVCs then they will be removed with the infrastructure resource group at the time of removing AKS cluster as the infra resource group is deleted during AKS delete. You can refer to this for more information.

Volumes defined and created as part of the pod lifecycle only exist until you delete the pod. Pods often expect their storage to remain if a pod is rescheduled on a different host during a maintenance event, especially in Stateful Sets. A persistent volume (PV) is a storage resource created and managed by the Kubernetes API that can exist beyond the lifetime of an individual pod. More information here.

So to extend the life span of the PVCs beyond the life span of the AKS cluster:

  • In case of dynamic disk PVCs back up and restore the disks. More info here

  • Or you can use statically provisioned Disk PVCs in a different resource group and mount it as volume as mentioned here.

Hope it helps!!!

Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.






5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.