首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Kubernetes NFS卷装载失败,退出状态为32

Kubernetes NFS卷装载失败,退出状态为32
EN

Stack Overflow用户
提问于 2015-12-06 11:08:45
回答 6查看 35.5K关注 0票数 22

我在我的Ubuntu机器上安装了Kubernetes安装程序。根据这个http://kubernetes.io/v1.1/examples/nfs/文档,我正在尝试设置一个nfs卷并将其挂载到一个容器中。

nfs服务和pod配置

代码语言:javascript
复制
kind: Service
apiVersion: v1
metadata:
  name: nfs-server
spec:
  ports:
    - port: 2049
  selector:
    role: nfs-server
---
apiVersion: v1
kind: Pod
metadata:
  name: nfs-server
  labels:
    role: nfs-server
spec:
  containers:
    - name: nfs-server
      image: jsafrane/nfs-data
      ports:
        - name: nfs
          containerPort: 2049
      securityContext:
        privileged: true

用于挂载nfs卷的pod配置

代码语言:javascript
复制
apiVersion: v1
kind: Pod
metadata:
  name: nfs-web
spec:
  containers:
    - name: web
      image: nginx
      ports:
        - name: web
          containerPort: 80
      volumeMounts:
          # name must match the volume name below
          - name: nfs
            mountPath: "/usr/share/nginx/html"
  volumes:
    - name: nfs
      nfs:
        # FIXME: use the right hostname
        server: 192.168.3.201
        path: "/"

当我运行kubectl describe nfs-web时,我得到以下输出,指出它无法挂载nfs卷。可能的原因是什么?

代码语言:javascript
复制
Name:               nfs-web
Namespace:          default
Image(s):           nginx
Node:               192.168.1.114/192.168.1.114
Start Time:         Sun, 06 Dec 2015 08:31:06 +0530
Labels:             <none>
Status:             Pending
Reason:             
Message:            
IP:             
Replication Controllers:    <none>
Containers:
  web:
    Container ID:   
    Image:      nginx
    Image ID:       
    State:      Waiting
      Reason:       ContainerCreating
    Ready:      False
    Restart Count:  0
    Environment Variables:
Conditions:
  Type      Status
  Ready     False 
Volumes:
  nfs:
    Type:   NFS (an NFS mount that lasts the lifetime of a pod)
    Server: 192.168.3.201
    Path:   /
    ReadOnly:   false
  default-token-nh698:
    Type:   Secret (a secret that should populate this volume)
    SecretName: default-token-nh698
Events:
  FirstSeen LastSeen    Count   From            SubobjectPath   Reason      Message
  ───────── ────────    ─────   ────            ─────────────   ──────      ───────
  36s       36s     1   {scheduler }                Scheduled   Successfully assigned nfs-web to 192.168.1.114
  36s       2s      5   {kubelet 192.168.1.114}         FailedMount Unable to mount volumes for pod "nfs-web_default": exit status 32
  36s       2s      5   {kubelet 192.168.1.114}         FailedSync  Error syncing pod, skipping: exit status 32
EN

回答 6

Stack Overflow用户

发布于 2016-03-04 09:50:40

我也遇到了同样的问题,我通过在每个Kubernetes节点上安装nfs-common解决了这个问题。

代码语言:javascript
复制
apt-get install -y nfs-common

我的节点安装时没有使用nfs-common。Kubernetes会要求每个节点将NFS挂载到pod可用的特定目录中。由于未找到mount.nfs,因此挂载过程失败。

祝好运!

票数 34
EN

Stack Overflow用户

发布于 2015-12-08 00:03:41

看起来您的客户端上的volumes.nfs.server=192.168.3.201配置不正确。它应该设置为您的nfs- ClusterIP服务的服务器地址。

票数 1
EN

Stack Overflow用户

发布于 2018-10-11 11:27:57

我通过在工作节点上安装nfs-utils修复了这个问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34113569

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档