AzureFile
AzureFile delivers a host file sharing service based on the SMB protocol (also known as CIFS). Catering to both Windows and Linux containers, AzureFile supports sharing across hosts, making it suitable for shared storage among multiple Pods. One shortcoming of AzureFile is its relatively poor performance (AKS#223), and it doesn't offer Premium storage.
To tap into the full potential of AzureFile, it's recommended that you use it as per StorageClass - like so:
Here are some versions of AzureFile we suggest using:
Kubernetes prototype | Preferred version |
---|---|
1.12 | 1.12.6 or higher |
1.13 | 1.13.4 or higher |
1.14 | 1.14.0 or higher |
>=1.15 | >=1.15 |
All About Access
AzureFile mounts its remote storage to the Node using mount.cifs, while fileMode
and dirMode
govern the resulting access permission for the files and folders. Different Kubernetes versions come with varying fileMode
and dirMode
default options:
Kubernetes version | fileMode and dirMode |
---|---|
v1.6.x, v1.7.x | 0777 |
v1.8.0-v1.8.5 | 0700 |
v1.8.6 or higher | 0755 |
v1.9.0 | 0700 |
v1.9.1-v1.12.1 | 0755 |
>=v1.12.2 | 0777 |
Default permissions can lead to non-root users losing the ability to create new files in directories. Here are a couple of solutions:
Wandering Pods Following Windows Node Restart
Following a Windows Node reboot, Pods mounted with AzureFile may display the following error (#60624):
A temporary solution involves deleting and re-creating Pods hosted on AzureFile. If the Pod uses controllers—like Deployment or StatefulSets—the controller will automatically generate a new Pod in its place once the old one is eradicated.
The issue's been resolved in v1.10 (#60625).
Provisioning Woes with AzureFile
Azure File shares are limited to a mere 63 characters—this means that clusters with exceedingly long names (Kubernetes v1.7.10 or older) may exceed AzureFile's character limit, leading to AzureFile ProvisioningFailed:
A cluster upgrade will solve such an issue, as the fix (#48326) is part of v1.7.11, v1.8, and all subsequent versions.
In clusters with the RBAC option enabled, AzureFile may not auto-authorize access to Secret in the kube-controller-manager, causing ProvisioningFailed.
To address this, just grant the Secret access permission to the ServiceAccount persistent-volume-binder
:
AzureFile and Azure German Cloud
Azure German Cloud only supports AzureFile as of v1.7.11+ and v1.8+ (#48460). Updating your Kubernetes version will solve this problem.
Dealing with the "Could not change permissions" Error
When running PostgreSQL on an Azure Files plugin, you may come across an error message like this:
This error is caused by the Azure File plugin using the cifs/SMB protocol. You can't change file and directory permission after mounting when using the cifs/SMB protocol. To solve this, you should use subpaths in conjunction with the Azure Disk plugin.
Further Reading
最后更新于