4

我正在尝试在 Google Container Engine (GKE) 上创建一个 kubernetes NFS 卷并让它被部署使用。

我在这个 github 存储库kubernetes-nfs-volume-on-gke中显示了几个步骤:

  1. 创建 GKE 集群和 GCE 永久性磁盘
  2. 配置 kubectl 处理 GKE 集群的上下文
  3. 创建 PersistentVolume (PV) 和 PersistentVolumeClaim (PVC)
  4. 创建 NFS 服务器
  5. 为 NFS 服务器创建服务以公开它(该服务的 IP 地址用于创建 NFS PV 和 NFS PVC)
  6. 创建 NFS 卷
  7. 创建一个用于检查 NFS 卷是否可访问的 busybox 部署。

经过这些步骤,这是得到的错误:

$ kubectl describe pods  nfs-busybox-2762569073-lhb5p
Name:       nfs-busybox-2762569073-lhb5p
Namespace:  default
Node:       gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb/10.240.0.3
Start Time: Wed, 12 Apr 2017 04:12:20 +0400
Labels:     name=nfs-busybox
        pod-template-hash=2762569073
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"nfs-busybox-2762569073","uid":"b1e523ae-1f14-11e7-a084-42010a8e0...
        kubernetes.io/limit-ranger=LimitRanger plugin set: cpu request for container busybox
Status:     Pending
IP:     
Controllers:    ReplicaSet/nfs-busybox-2762569073
Containers:
  busybox:
    Container ID:
    Image:      busybox
    Image ID:       
    Port:       
    Command:
      sh
      -c
      while true; do date > /mnt/index.html; hostname >> /mnt/index.html; sleep $(($RANDOM % 5 + 5)); done
    State:      Waiting
      Reason:       ContainerCreating
    Ready:      False
    Restart Count:  0
    Requests:
      cpu:      100m
    Environment:    <none>
    Mounts:
      /mnt from my-pvc-nfs (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-20n4b (ro)
Conditions:
  Type      Status
  Initialized   True
  Ready     False
  PodScheduled  True
Volumes:
  my-pvc-nfs:
    Type:   PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  nfs
    ReadOnly:   false
  default-token-20n4b:
    Type:   Secret (a volume populated by a Secret)
    SecretName: default-token-20n4b
    Optional:   false
QoS Class:  Burstable
Node-Selectors: <none>
Tolerations:    <none>
Events:
  FirstSeen LastSeen    Count   From                                SubObjectPath   Type        Reason      Message
  --------- --------    -----   ----                                -------------   --------    ------      -------
  5m        5m      1   default-scheduler                               Normal      Scheduled   Successfully assigned nfs-busybox-2762569073-lhb5p to gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb
  3m        48s     2   kubelet, gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb           Warning     FailedMount Unable to mount volumes for pod "nfs-busybox-2762569073-lhb5p_default(b1e7c901-1f14-11e7-a084-42010a8e0116)": timeout expired waiting for volumes to attach/mount for pod "default"/"nfs-busybox-2762569073-lhb5p". list of unattached/unmounted volumes=[my-pvc-nfs]
  3m        48s     2   kubelet, gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb           Warning     FailedSync  Error syncing pod, skipping: timeout expired waiting for volumes to attach/mount for pod "default"/"nfs-busybox-2762569073-lhb5p". list of unattached/unmounted volumes=[my-pvc-nfs]
  37s       37s     1   kubelet, gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb           Warning     FailedMount MountVolume.SetUp failed for volume "kubernetes.io/nfs/b1e7c901-1f14-11e7-a084-42010a8e0116-nfs" (spec.Name: "nfs") pod "b1e7c901-1f14-11e7-a084-42010a8e0116" (UID: "b1e7c901-1f14-11e7-a084-42010a8e0116") with: mount failed: exit status 32
Mounting command: /home/kubernetes/bin/mounter
Mounting arguments: 10.247.250.208:/exports /var/lib/kubelet/pods/b1e7c901-1f14-11e7-a084-42010a8e0116/volumes/kubernetes.io~nfs/nfs nfs []
Output: Running mount using a rkt fly container
run: group "rkt" not found, will use default gid when rendering images 

在 Kubernetes Dashboard 中,报错如下:

无法为 pod“nfs-busybox-2762569073-lhb5p_default(b1e7c901-1f14-11e7-a084-42010a8e0116)”挂载卷:超时已过期等待卷为 pod“default”/“nfs-busybox-2762569073-lhb5p 附加/挂载” ”。未附加/卸载卷列表=[my-pvc-nfs]

同步 pod 时出错,跳过:等待卷附加/挂载 pod“默认”/“nfs-busybox-2762569073-lhb5p”的超时已过期。未附加/卸载卷列表=[my-pvc-nfs]

我错过了什么吗?

谢谢,

4

1 回答 1

2

这个关于 kubernetes的问题的评论似乎解决了 GKE 上的这个 NFS 问题。

引用该评论:

编辑examples/volumes/nfs/nfs-pv.yaml将最后一行更改为路径:"/"

编辑examples/volumes/nfs/nfs-server-rc.yaml将图像更改为启用 NFSv4 图像的图像:gcr.io/google_containers/volume-nfs:0.8

还有其他问题可以在此处此处进行跟踪。

于 2017-04-20T06:37:34.937 回答