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

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

nfs服务和podconfiguration

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 

podconfiguration挂载nfs卷

 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卷。 这可能是什么原因?

 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来解决这个问题。

 apt-get install -y nfs-common 

我的节点没有安装nfs-common。 Kubernetes将要求每个节点将NFS挂载到一个特定的目录中,以便可用于该pod。 由于未findmount.nfs ,挂载过程失败。

祝你好运!

现在有这个问题…使用coreos-alpha (1010.1.0)

使用来自quay.io的 Kubernetes v1.2.2_coreos.0图像

群集外部的NFS服务器的RHEL。 一切工作正常。 唯一的问题是pod安装nfs份额。

PV,PVC的创造似乎没问题…

  16m 5s 77 {kubelet 10.163.224.136} Warning FailedMount Unable to mount volumes for pod "es-data-xvzxl_default(65b2c286-078e-11e6-99f9-005056a71442)": Mount failed: exit status 32 Mounting arguments: 10.163.224.128:/data/kubefs /var/lib/kubelet/pods/65b2c286-078e-11e6-99f9-005056a71442/volumes/kubernetes.io~nfs/pv0001 nfs [] Output: mount: wrong fs type, bad option, bad superblock on 10.163.224.128:/data/kubefs, missing codepage or helper program, or other error (for several filesystems (eg nfs, cifs) you might need a /sbin/mount.<type> helper program) In some cases useful info is found in syslog - try dmesg | tail or so. 

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

我也在V1.1.2上遇到了这个挂载/同步问题,并且在K8之外运行了一个独立的NFS服务。

虽然我还没有弄清楚它是否是K8中的一个bug,或者我的NFS服务器是否正在运行,但是我认为它是前者,因为我没有对NFS做任何特殊的处理,通常最终发生的是Pod最终会自动重新启动,事情“正常工作”,或者我必须kubectl delete/create手动kubectl delete/create它。

我知道这不是最佳的,也不是根本问题的确定性,而是我目前的创可贴解决scheme。