Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes persistent volumes with azureFile

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

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) 

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

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

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

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

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"}
like image 621
R. de Vries Avatar asked Nov 08 '22 03:11

R. de Vries


1 Answers

I had a blog discussion the errors when mounting Azure files. The permission denied error might be due to the following reasons:

  1. The Azure storage account name and/or key were not encoded with base64 algorithm;
  2. The Azure storage account name and/or key were encoded with command echo rather than echo -n;
  3. The location of Azure storage account was different from the location of container host.
like image 54
Harry He Avatar answered Nov 15 '22 07:11

Harry He