I am attempting to mount my Azure File Storage to a container using the method found here: https://github.com/kubernetes/kubernetes/tree/master/examples/volumes/azure_file
Upon pod creation I am getting the error: "Output: mount error: could not resolve address for [encoded name of my file storage].file.core.windows.net: Unknown error"
I have confirmed that my File Storage resource and the VM hosting the pod are in the same Azure location (East US). I am able to mount this share manually on the VM hosting the pod using the same address in the error above. Is it possible I am missing some sort of configuration in my container that is not explained in the Git Hub tutorial?
I have tried creating my container without specifying the volume and was able to ping the address for the file storage from within the container so I am not sure where the cannot resolve address error is coming from.
Remember to use flag
-n
to avoid echoing trailing characters:echo -n foobarbaz | base64
I can't reproduce your error, but we can follow those steps to mount Azure file share to k8s container.
1.create k8s via Azure new portal.
2.SSH k8s master, create
secret
, create secret by k8s file:In this yaml file, we should write storage account and key in it, and we should base64 encoded Azure storage account and key, like this:
Then create
azure-secret
:Here is the azure-secret:
root@k8s-master-3CC6E803-0:/azure_file# cat azure-secret.yaml
Then use kubectl to create secret,like this:
3.Create pod: create azure.yaml:
Use this file to create pod:
Now, pod create is completed, we can use this script to check file,like this:
Note:
1.We should base64 encoded Azure storage account and key.
2.write the right file share name to azure.yaml:
There is also dynamic provisioning for azure file mount feature, you could find complete examples here: https://github.com/andyzhangx/Demo/tree/master/linux/azuredfile