2015-12-06 69 views
3

我的Ubuntu機器上安裝了Kubernetes安裝程序。我正在嘗試設置一個nfs卷並根據此http://kubernetes.io/v1.1/examples/nfs/文檔將其掛載到一個容器中。Kubernetes NFS卷掛載失敗,退出狀態32

NFS服務莢配置

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卷

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的網絡我得到以下輸出提的是無法掛載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 

回答

0

它看起來像在您的客戶端上錯誤地配置volumes.nfs.server = 192.168.3.201。它應該設置爲nfs-server Service的ClusterIP地址。

0

我也在v1.1.2上遇到了這個掛載/同步問題,並且在K8之外運行了一個獨立的NFS服務。

雖然我一直無法弄清楚它在K8s中的錯誤還是我的NFS服務器正在動作,但我認爲它是前者,因爲我沒有對NFS做任何特殊的處理,通常是什麼最終發生的事情是,Pod最終會自動重新啓動,並且事情「正常工作」,或者我必須手動執行該操作。

我知道這不是最佳的,也不是確定性的根本問題本身,但它是我目前的創可貼解決方案。

4

我有同樣的問題,我通過在每個Kubernetes節點中安裝nfs-common來解決它。

apt-get install -y nfs-common 

我的節點安裝時沒有nfs-common。 Kubernetes會要求每個節點將NFS掛載到一個特定的目錄中,以便可用於該pod。 As mount.nfs未找到,安裝過程失敗。

祝你好運!

1

現在有了這個問題...使用coreos-alpha (1010.1.0)

quay.io

RHEL的NFS服務器羣集外部使用Kubernetes v1.2.2_coreos.0圖像。一切正常。唯一的問題是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 (e.g. 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. 
+1

'NFS-common'從'hyperkube'圖像丟失,所以@kikoV已經確定的根本原因。有關更多詳細信息和解決方法,請參閱此github問題:https://github.com/coreos/coreos-kubernetes/issues/372 – morloch

相關問題