本文介绍了Kubernetes NFS卷安装失败,退出状态为32的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu机器上安装了Kubernetes安装程序.我正在尝试根据此 http://来设置nfs卷并将其安装到容器中kubernetes.io/v1.1/examples/nfs/文档.

I have a Kubernetes setup installed in my Ubuntu machine. I'm trying to setup a nfs volume and mount it to a container according to this http://kubernetes.io/v1.1/examples/nfs/ document.

nfs服务和pod配置

nfs service and pod configurations

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配置

pod configuration to mount nfs volume

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描述nfs-web时,我得到以下输出,提示它无法挂载nfs卷.可能是什么原因?

When I run kubectl describe nfs-web I get following output mentioning it was unable to mount nfs volume. What could be the reason for that?

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

推荐答案

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

I had the same problem, and I solved it by installing nfs-common in every Kubernetes nodes.

apt-get install -y nfs-common

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

My nodes were installed without nfs-common. Kubernetes will ask each node to mount the NFS into a specific directory to be available to the pod. As mount.nfs was not found, the mounting process failed.

祝你好运!

这篇关于Kubernetes NFS卷安装失败,退出状态为32的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 22:55