<p>I'm trying to create a persistent volume using the azureFile however I keep getting the following error.</p>

<pre><code>MountVolume.SetUp failed for volume "kubernetes.io/azure-file/2882f900-d7de-11e6-affc-000d3a26076e-pv0001" (spec.Name: "pv0001") pod "2882f900-d7de-11e6-affc-000d3a26076e" (UID: "2882f900-d7de-11e6-affc-000d3a26076e") with: mount failed: exit status 32 Mounting arguments: //xxx.file.core.windows.net/test /var/lib/kubelet/pods/2882f900-d7de-11e6-affc-000d3a26076e/volumes/kubernetes.io~azure-file/pv0001 cifs [vers=3.0,username=xxx,password=xxx ,dir_mode=0777,file_mode=0777] Output: mount error(13): Permission denied Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) 
</code></pre>

<p>I also tried mounting the share in one of the VM's on which kubernetes is running which does work.</p>

<p>I've used the following configuration to create the pv/pvc/pod.</p>

<pre><code>apiVersion: v1
kind: Secret
metadata:
  name: azure-secret
type: Opaque
data:
  azurestorageaccountkey: [base64 key]
  azurestorageaccountname: [base64 accountname]

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0001
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  azureFile:
    secretName: azure-secret
    shareName: test
    readOnly: false


kind: Pod
apiVersion: v1
metadata:
  name: mypod
spec:
  containers:
    - name: mypod
      image: nginx
      volumeMounts:
      - mountPath: "/mnt"
        name: mypd
  volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: pvc0001
</code></pre>

<p>This the version of kubernetes I'm using, which was build using the azure container service.</p>

<pre><code>Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.5", GitCommit:"5a0a696437ad35c133c0c8493f7e9d22b0f9b81b", GitTreeState:"clean", BuildDate:"2016-10-29T01:38:40Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.6", GitCommit:"e569a27d02001e343cb68086bc06d47804f62af6", GitTreeState:"clean", BuildDate:"2016-11-12T05:16:27Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>I had <a href="http://harrytechnotes.blogspot.com/2017/08/kubernetes-3-failed-to-mount-azure-files.html" rel="nofollow noreferrer">a blog</a> discussion the errors when mounting Azure files. The <code>permission denied</code> error might be due to the following reasons:</p>

<ol>
<li>The Azure storage account name and/or key were not encoded with base64 algorithm;</li>
<li>The Azure storage account name and/or key were encoded with command <code>echo</code> rather than <code>echo -n</code>;</li>
<li>The location of Azure storage account was different from the location of container host.</li>
</ol>
