Kubernetes-“挂载失败"尝试部署时 [英] Kubernetes - "Mount Volume Failed" when trying to deploy

查看:249
本文介绍了Kubernetes-“挂载失败"尝试部署时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我部署了第一个容器,我得到了以下信息:

I deployed my first container, I got info:

deployment.apps/frontarena-ads-deployment created

,但是随后我看到我的容器创建处于等待"状态. 然后我看到了使用kubectl describe pod frontarena-ads-deployment-5b475667dd-gzmlp的日志,并看到了MountVolume错误,我无法弄清楚为什么会抛出它:

but then I saw my container creation is stuck in Waiting status. Then I saw the logs using kubectl describe pod frontarena-ads-deployment-5b475667dd-gzmlp and saw MountVolume error which I cannot figure out why it is thrown:

警告失败安装9m24s kubelet MountVolume.SetUp 卷"ads-filesharevolume"失败; :挂载失败:退出状态32挂载命令: systemd运行的安装参数:--description = Kubernetes瞬态 登上 /var/lib/kubelet/pods/85aa3bfa-341a-4da1-b3de-fb1979420028/volumes/kubernetes.io~azure-file/ads-filesharevolume --scope-mount -t cifs -o username = frontarenastorage,password = mypassword,file_mode = 0777,dir_mode = 0777,vers = 3.0 //frontarenastorage.file.core.windows.net/azurecontainershare /var/lib/kubelet/pods/85aa3bfa-341a-4da1-b3de-fb1979420028/volumes/kubernetes.io~azure-file/ads-filesharevolume 输出:运行范围作为单位 运行-rf54d5b5f84854777956ae0e25810bb94.scope.安装错误(115): 现在正在进行操作请参阅mount.cifs(8)手册页(例如 man mount.cifs)

Warning FailedMount 9m24s kubelet MountVolume.SetUp failed for volume "ads-filesharevolume" : mount failed: exit status 32 Mounting command: systemd-run Mounting arguments: --description=Kubernetes transient mount for /var/lib/kubelet/pods/85aa3bfa-341a-4da1-b3de-fb1979420028/volumes/kubernetes.io~azure-file/ads-filesharevolume --scope -- mount -t cifs -o username=frontarenastorage,password=mypassword,file_mode=0777,dir_mode=0777,vers=3.0 //frontarenastorage.file.core.windows.net/azurecontainershare /var/lib/kubelet/pods/85aa3bfa-341a-4da1-b3de-fb1979420028/volumes/kubernetes.io~azure-file/ads-filesharevolume Output: Running scope as unit run-rf54d5b5f84854777956ae0e25810bb94.scope. mount error(115): Operation now in progress Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

在运行部署之前,我已经使用在YAML中引用的已经创建的Azure文件共享在Azure中创建了一个机密.

Before I run the deployment I created a secret in Azure, using the already created azure file share, which I referenced within the YAML.

$AKS_PERS_STORAGE_ACCOUNT_NAME="frontarenastorage"
$STORAGE_KEY="mypassword"
kubectl create secret generic fa-fileshare-secret --from-literal=azurestorageaccountname=$AKS_PERS_STORAGE_ACCOUNT_NAME --from-literal=azurestorageaccountkey=$STORAGE_KEY

在该文件共享中,我具有需要挂载的文件夹和文件,并在YAML中引用了 azurecontainershare :

In that file share I have folders and files which I need to mount and I reference azurecontainershare in YAML:

我的YAML看起来像这样:

My YAML looks like this:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontarena-ads-deployment
  labels:
    app: frontarena-ads-deployment
spec:
  replicas: 1
  template:
    metadata:
      name: frontarena-ads-aks-test
      labels:
        app: frontarena-ads-aks-test
    spec:
      containers:
      - name: frontarena-ads-aks-test
        image: faselect-docker.dev/frontarena/ads:test1
        imagePullPolicy: Always
        ports:
          - containerPort: 9000
        volumeMounts:
          - name: ads-filesharevolume
            mountPath: /opt/front/arena/host
      volumes:
      - name: ads-filesharevolume
        azureFile:
          secretName: fa-fileshare-secret
          shareName: azurecontainershare
          readOnly: false
      imagePullSecrets:
        - name: fa-repo-secret
  selector:
    matchLabels:
      app: frontarena-ads-aks-test

推荐答案

出现此问题是由于在其中部署了AKS群集和Azure文件共享的不同Azure区域.如果他们在同一地区,则不会有此问题.

The Issue was because of the different Azure Regions in which AKS cluster and Azure File Share are deployed. If they are in the same Region you would not have this issue.

这篇关于Kubernetes-“挂载失败"尝试部署时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆