0

我正在尝试在 CoreOS 下 kubernetes 创建的 pod 中安装 ceph RDB 卷。

  • CoreOS 版本为beta (1153.4.0)
  • Hyperkube 版本是v1.3.7+coreos.0
  • ceph版本是jewel

是否使用此 POD:

{
  "apiVersion": "v1",
  "kind": "Pod",
  "metadata": {
    "name": "rbd2"
  },
  "spec": {
    "containers": [
      {
        "name": "rbd-rw",
        "image": "nginx",
        "volumeMounts": [
          {
            "mountPath": "/mnt/rbd",
            "name": "rbdpd"
          }
        ]
      }
    ],
    "volumes": [
      {
        "name": "rbdpd",
        "rbd": {
          "monitors": [
            "10.203.69.254"
          ],
          "pool": "rbd",
          "image": "foo",
          "user": "admin",
          "secretRef": {
            "name": "ceph-secret"
          },
          "fsType": "ext4",
          "readOnly": true
        }
      }
    ]
  }
}

如果我启动这个 pod,它会被创建但保持状态:ContainerCreating

问题是 pod 似乎无法创建 rbd 设备。

如果我连接到已部署 pod 的节点并使用rbdmap命令创建 rbd 设备(在主机上),则创建设备并且 pod 可以挂载卷。然后 pod 的状态切换到Running

如果我删除 pod,则会自动删除 rbd 设备。

恢复,可能是什么问题导致 kubernetes 无法创建 rbd 设备。

4

1 回答 1

1

If you are using the CoreOS kubelet-wrapper script to launch the kubelet, you should be able to use rbd devices by adding a few extra mount points.

An example override of the RKT_OPTS for the kubelet-wrapper:

[Service]
Environment="RKT_OPTS=--volume modprobe,kind=host,source=/usr/sbin/modprobe \
--mount volume=modprobe,target=/usr/sbin/modprobe \
--volume lib-modules,kind=host,source=/lib/modules \
--mount volume=lib-modules,target=/lib/modules \
Environment=KUBELET_VERSION=v1.3.7_coreos.0
...

Source: kubelet-wrapper rbd docs.

于 2016-09-22T17:14:25.200 回答