Kubernetes使用azureFile持久化卷

时间:2017-01-11 10:07:39

标签: azure kubernetes volumes azure-files persistent-volumes

我正在尝试使用azureFile创建持久卷但是我一直收到以下错误。

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) 

我还尝试在其中一个正在运行kubernetes的VM上安装共享,这样做有效。

我使用以下配置来创建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

这是我正在使用的kubernetes版本,它是使用azure容器服务构建的。

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"}

1 个答案:

答案 0 :(得分:1)

我在安装Azure文件时a blog讨论了错误。 permission denied错误可能是由于以下原因造成的:

  1. Azure存储帐户名称和/或密钥未使用base64算法进行编码;
  2. Azure存储帐户名称和/或密钥使用命令echo而不是echo -n进行编码;
  3. Azure存储帐户的位置与容器主机的位置不同。