2016-08-17 18 views
5

Tôi đang cố gắn kết ổ đĩa NFS vào nhóm của mình nhưng không thành công.Kubernetes Không thể gắn ổ đĩa cho nhóm với thời gian chờ

Tôi có một máy chủ chạy nfs điểm gắn kết, khi tôi cố gắng để kết nối với nó từ một số máy chủ đang chạy khác

sudo mount -t nfs -o proto=tcp,port=2049 10.0.0.4:/export /mnt hoạt động tốt

Một điều đáng nói là khi tôi loại bỏ các khối lượng từ việc triển khai và nhóm đang chạy. Tôi đăng nhập vào nó và tôi có thể telnet đến 10.0.0.4 với cổng 111 và 2049 thành công. do đó thực sự doesnt dường như là bất kỳ vấn đề thông tin liên lạc

cũng như:

showmount -e 10.0.0.4 
Export list for 10.0.0.4: 
/export/drive 10.0.0.0/16 
/export  10.0.0.0/16 

Vì vậy, tôi có thể giả định rằng không có vấn đề về mạng hoặc cấu hình giữa máy chủ và máy khách (Tôi sử dụng Amazon và máy chủ mà tôi đã thử nghiệm nằm trong cùng một nhóm bảo mật như các k8s minions)

PS: Máy chủ là một ubuntu đơn giản-> 50gb đĩa

Kubernetes v1.3.4

Vì vậy, tôi bắt đầu tạo PV tôi

apiVersion: v1 
kind: PersistentVolume 
metadata: 
    name: nfs 
spec: 
    capacity: 
    storage: 50Gi 
    accessModes: 
    - ReadWriteMany 
    nfs: 
    server: 10.0.0.4 
    path: "/export" 

Và PVC tôi

kind: PersistentVolumeClaim 
apiVersion: v1 
metadata: 
    name: nfs-claim 
spec: 
    accessModes: 
    - ReadWriteMany 
    resources: 
    requests: 
     storage: 50Gi 

đây là cách kubectl mô tả chúng:

Name:  nfs 
    Labels:  <none> 
    Status:  Bound 
    Claim:  default/nfs-claim 
    Reclaim Policy: Retain 
    Access Modes: RWX 
    Capacity: 50Gi 
    Message: 
    Source: 
     Type: NFS (an NFS mount that lasts the lifetime of a pod) 
     Server: 10.0.0.4 
     Path: /export 
     ReadOnly: false 
    No events. 

Name:  nfs-claim 
    Namespace: default 
    Status:  Bound 
    Volume:  nfs 
    Labels:  <none> 
    Capacity: 0 
    Access Modes: 
    No events. 

pod triển khai:

apiVersion: extensions/v1beta1 
    kind: Deployment 
    metadata: 
     name: mypod 
     labels: 
     name: mypod 
    spec: 
     replicas: 1 
     strategy: 
     rollingUpdate: 
      maxSurge: 1 
      maxUnavailable: 0 
     type: RollingUpdate 
     template: 
     metadata: 
      name: mypod 
      labels: 
      # Important: these labels need to match the selector above, the api server enforces this constraint 
      name: mypod 
     spec: 
      containers: 
      - name: abcd 
      image: irrelevant to the question 
      ports: 
      - containerPort: 80 
      env: 
      - name: hello 
       value: world 
      volumeMounts: 
      - mountPath: "/mnt" 
       name: nfs 
      volumes: 
      - name: nfs 
       persistentVolumeClaim: 
       claimName: nfs-claim 

Khi tôi triển khai POD của tôi nhận được như sau:

Volumes: 
     nfs: 
     Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) 
     ClaimName: nfs-claim 
     ReadOnly: false 
     default-token-6pd57: 
     Type: Secret (a volume populated by a Secret) 
     SecretName: default-token-6pd57 
    QoS Tier: BestEffort 
    Events: 
     FirstSeen LastSeen Count From       SubobjectPath Type  Reason  Message 
     --------- -------- ----- ----       ------------- -------- ------  ------- 
     13m  13m  1 {default-scheduler }       Normal  Scheduled Successfully assigned xxx-2140451452-hjeki to ip-10-0-0-157.us-west-2.compute.internal 
     11m  7s  6 {kubelet ip-10-0-0-157.us-west-2.compute.internal}   Warning  FailedMount Unable to mount volumes for pod "xxx-2140451452-hjeki_default(93ca148d-6475-11e6-9c49-065c8a90faf1)": timeout expired waiting for volumes to attach/mount for pod "xxx-2140451452-hjeki"/"default". list of unattached/unmounted volumes=[nfs] 
     11m  7s  6 {kubelet ip-10-0-0-157.us-west-2.compute.internal}   Warning  FailedSync Error syncing pod, skipping: timeout expired waiting for volumes to attach/mount for pod "xxx-2140451452-hjeki"/"default". list of unattached/unmounted volumes=[nfs] 

thử tất cả mọi thứ tôi biết, và tất cả mọi thứ tôi có thể nghĩ đến. Tôi đang thiếu gì hoặc làm sai ở đây?

Trả lời

1

Tôi đã thử nghiệm phiên bản 1.3.4 và 1.3.5 của Kubernetes và NFS gắn kết đã không làm việc cho tôi. Sau đó tôi chuyển sang phiên bản 1.2.5 và phiên bản đó đã cho tôi một số thông tin chi tiết hơn (kubectl mô tả pod ...). Hóa ra là 'nfs-common' bị thiếu trong hình ảnh hyperkube. Sau khi tôi thêm nfs-common cho tất cả các trường hợp container dựa trên hyperkube image trên các nút master và worker, NFS share bắt đầu hoạt động bình thường (mount đã thành công). Vì vậy, đó là trường hợp ở đây. Tôi đã thử nghiệm nó trong thực tế và nó giải quyết được vấn đề của tôi.

+0

Tôi có thể thấy rằng sự cố đã được mở để có hy vọng khắc phục chính thức cho vấn đề này: https://github.com/kubernetes/kubernetes/issues/30310 – dejwsz

+0

Thực ra, bản sửa lỗi được áp dụng trong nhánh 'chính' của hình ảnh hyperkube (xem định nghĩa Dockerfile) – dejwsz

Các vấn đề liên quan