在 Google Kubernetes Engine (GKE) 中安装 Rook 卷

Mounting Rook Volumes in Google Kubernetes Engine (GKE)

我一直在研究 Kubernetes 的 Rook+Ceph,试图让它在 Google Kubernetes Engine 下工作,但碰壁了。

根据文档,我 运行 执行了以下命令,并验证了每个命令都达到了预期效果:

kubectl create -f common.yaml
kubectl create -f operator.yaml
kubectl create -f cluster.yaml
kubectl create -f filesystem.yaml

yaml文件都默认为provided by Rook, with the exception of operator.yaml, wherein I've added the following environment variable, as per the GKE docs:

- name: FLEXVOLUME_DIR_PATH
  value: "/home/kubernetes/flexvolume"

但是,我不确定从这里到哪里去。他们的文档有一个 creating a registry 的示例文件,它导致了一个看似与我想要实现的目标无关的指令的兔子洞。

基本上,我希望能够将 Ceph 共享文件存储挂载为来自常规 ol' 容器映像的卷。我尝试了以下 yaml 但没有成功:

apiVersion: v1
kind: Pod
metadata:
  name: ubuntu
  namespace: default
spec:
  containers:
  - name: ubuntu
    image: ubuntu:bionic
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
    volumeMounts:
    - name: image-store
      mountPath: /mnt/shared
  volumes:
  - name: image-store
    flexVolume:
      driver: ceph.rook.io/rook
      fsType: ceph
      options:
        fsName: myfs
        clusterNamespace: rook-ceph
  restartPolicy: Always

以我相当有限的知识,我不明白为什么这不起作用,但是在执行 kubectl describe pods ubuntu:

时得到以下输出
Mounting command: systemd-run
Mounting arguments: --description=Kubernetes transient mount for /var/lib/kubelet/pods/10ee80d1-8873-11e9-8f45-42010a8a01d8/volumes/ceph.rook.io~rook/image-store --scope -- mount -t ceph -o name=admin,secret=AQDAM/lcQFKHARAAh/O27Wl+iRKRzREsMML+4g==,mds_namespace=myfs 10.8.3.134:6789,10.8.13.226:6789,10.8.5.39:6789:/ /var/lib/kubelet/pods/10ee80d1-8873-11e9-8f45-42010a8a01d8/volumes/ceph.rook.io~rook/image-store
Output: Running scope as unit: run-reb61186d1ff64e6e846a200580aa5395.scope
mount: /var/lib/kubelet/pods/10ee80d1-8873-11e9-8f45-42010a8a01d8/volumes/ceph.rook.io~rook/image-store: special device 10.8.3.134:6789,10.8.13.226:6789,10.8.5.39:6789:/ does not exist.
  Warning  FailedMount  51s (x2 over 2m53s)  kubelet, gke-kubey-cluster-default-pool-6856b374-nb0c  (combined from similar events): MountVolume.SetUp failed for volume "image-store" : mount command failed, status: Failure, reason: failed to mount filesystem myfs to /var/lib/kubelet/pods/10ee80d1-8873-11e9-8f45-42010a8a01d8/volumes/ceph.rook.io~rook/image-store with monitor 10.8.3.134:6789,10.8.13.226:6789,10.8.5.39:6789:/ and options [name=admin secret=AQDAM/lcQFKHARAAh/O27Wl+iRKRzREsMML+4g== mds_namespace=myfs]: mount failed: exit status 32

有没有例子说明如何在野外某处实现这样的事情?

确保您满足房间设置的每一个先决条件:rook_setup

然后尝试安装:

nfs-common

在您的所有节点上。