Monday, August 7, 2017

Kubernetes Notes (3): Failed to Mount Azure Files


We may meet failures when we try to mount Azure files onto containers orchestrated by Kubernetes. Here is about how to resolve the failures.

The first error complains "No such file or directory" when describing the pod with kubectl, as shown in the following image:

The error complaining "No such file or directory"

The root cause of this issue is that the Azure file share declared in volumes.azureFile.shareName property of the pod deployment configure doesn't exit. Please go the Azure portal to create an Azure file share under your Azure storage account.

Another error complains "Permission denied" when describing the pod with kubectl, as shown in the screenshot below:

The error message complaining "Permission denied"

Of course, we will meet this error when the storage account name or key in the secret is incorrect. Kubernetes requires that secrets should be encoded with base64 algorithm. If we just copy the storage account names and keys into Kubernetes secrets, we will see such an error.

Many ones encode secrets with the Linux echo command and then pipe it into base64. Please make sure use the "-n" option with the echo command, otherwise we will meet the "permission denied" error. The following screenshot demonstrate that different encoded strings are returned when encoding with or without the "-n" option:

The "-n" option of echo command

Another somewhat counterintuitive issue which also triggers "Permission denied" error is that the location of storage account is different from the location of container hosts. Please go to the portal to check the location of the storage account and VMs.

No comments:

Post a Comment

Kubernetes Notes (3): Failed to Mount Azure Files

We may meet failures when we try to mount Azure files onto containers orchestrated by Kubernetes. Here is about how to resolve the failur...