Unable to set NFS mount as default storage for kubernetes pods on Azure AKS nodes

8/23/2019

I have set up AKS cluster with 14 Linux nodes. I am deploying code using helm charts. The pods with manual storageClass get created successfully but the ones that use default storageClass fail to create a persistent volume claim with the error.

Warning ProvisioningFailed (x894 over 33h) persistentvolume-controller Failed to provision volume with StorageClass "default": azureDisk - claim.Spec.Selector is not supported for dynamic provisioning on Azure disk

I tried creating an NFS storage and add that to the kubernetes cluster using kubectl command but the pods are not using the that NFS mount for volume creation.

kubectl describe pvc dev-aaf-aaf-sms -n onap
Name:          dev-aaf-aaf-sms
Namespace:     onap
StorageClass:  default
Status:        Pending
Volume:        
Labels:        app=aaf-sms
                chart=aaf-sms-4.0.0
                heritage=Tiller
                release=dev-aaf
Annotations:   volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/azure-disk
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    dev-aaf-aaf-sms-6bbffff5db-qxm7j
Events:
    Type     Reason              Age                        From                         Message
    ----     ------              ----                       ----                         -------
    Warning  ProvisioningFailed  <invalid> (x894 over 33h)  persistentvolume-controller  Failed to provision volume with StorageClass "default": azureDisk - claim.Spec.Selector is not supported for dynamic provisioning on Azure disk

Can someone with Azure AKS or Kubernetes understanding provide some guidance here.
Q: Is it possible to setup a default NFS volume mount for all nodes on an AKS cluster using kubectl?

It appears to be a compatibility constraint between Azure and Kubernetes for “default” storageClass. For PV with “manual” storageClass, PVC gets dynamically created successfully. So we need to define the default storageClass for nodes on the AKS cluster. In my case I need to define it as an NFS mount.

I know how to do it on an individual VM after installing kubernetes on it but I am struggling to set it for all nodes of an AKS cluster. Azure documentation only talks about doing it at pod level and not node level

-- Atif
azure-aks
kubernetes
nfs
persistent-volume-claims
storage-class-specifier

1 Answer

8/23/2019

you are clearly "hitting" this piece of code which implies that you cannot have selector on your PVC.spec

-- 4c74356b41
Source: StackOverflow