CephFS卷安装失败

时间:2017-01-03 21:38:41

标签: kubernetes ceph

我已使用docker-multinode configuration以及Ceph群集成功部署了Kubernetes群集,并且能够使用以下方法手动安装CephFS设备:

sudo mount -t ceph monitor1:6789:/ /ceph -o name=admin,secretfile=/etc/ceph/cephfs.secret

我现在正尝试使用kubernetes示例here启动一个pod:

apiVersion: v1
kind: Secret
metadata:
  name: ceph-secret
data:
  key: my-ceph-secret-key
---
apiVersion: v1
kind: Pod
metadata:
  name: cephfs2
spec:
  containers:
  - name: cephfs-rw
    image: kubernetes/pause
    volumeMounts:
    - mountPath: "/mnt/cephfs"
      name: cephfs
  volumes:
  - name: cephfs
    cephfs:
      monitors:
      - "monitor1:6789"
      - "monitor2:6789"
      - "monitor3:6789"
      user: admin
      secretRef:
        name: ceph-secret
      readOnly: false

当我跑步时:

sudo kubectl create -f cephfs.yml

我收到以下错误:

  

警告FailedMount MountVolume.SetUp卷失败   " kubernetes.io/cephfs/445ee063-d1f1-11e6-a3e3-1418776a29a6-cephfs"   (spec.Name:" cephfs")pod" 445ee063-d1f1-11e6-a3e3-1418776a29a6" (UID:   " 445ee063-d1f1-11e6-a3e3-1418776a29a6")with:CephFS:mount failed:   mount失败:fork / exec / bin / mount:无效参数挂载   参数:monitor1:6789,monitor2:6789,monitor3:6789:/ data   /var/lib/kubelet/pods/445ee063-d1f1-11e6-a3e3-1418776a29a6/volumes/kubernetes.io~cephfs/cephfs   ceph [name = admin,secret = secret]

kubernetes管理器容器是否需要安装ceph-fs-common软件包才能成功安装?我找不到任何进一步的调试信息来确定错误的原因。

2 个答案:

答案 0 :(得分:2)

AFAIK你可能有两个问题:

  • Ceph需要机器的IP地址才能工作
  • 您正在运行容器的操作系统是安装存储的操作系统:需要在该计算机上安装ceph工具。容器完全不知道已安装的磁盘

答案 1 :(得分:0)

为了在kubernetes中成功安装CephFS卷,需要修复一些问题。请记住,我已使用kube-deploy docker multinode配置部署了Kubernetes 1.4.6。

问题#1:挂载命令使用Kubernetes机密失败

当仔细检查上述错误时,我发现Kubernetes使用被解释为换行符的字符加密我的Ceph秘密。因此,在尝试挂载文件系统时,kubelet会失败。

要解决此问题,我将我的YAML配置为使用Ceph 1>------ Build started: Project: conn, Configuration: Release Win32 1> test.cpp 1>LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup' 1>mysqlcppconn-static.lib(mysql_driver.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1700' in test.obj 1>mysqlcppconn-static.lib(mysql_driver.obj) : error LNK2038: mismatch 1>mysqlcppconn-static.lib(dtoa.obj) : error LNK2001: unresolved external symbol __dtoui3 1>mysqlcppconn-static.lib(timer.obj) : error LNK2001: unresolved external symbol __dtoui3 1>mysqlcppconn-static.lib(dh.obj) : error LNK2001: unresolved external symbol __dtoui3 1>mysqlcppconn-static.lib(libmysql.obj) : error LNK2001: unresolved external symbol __ftol3 1>mysqlcppconn-static.lib(libmysql.obj) : error LNK2001: unresolved external symbol __ftoul3 1>c:\users\pcw\documents\visual studio 2012\Projects\conn\Release\conn.exe : fatal error LNK1120: 7 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 而不是Kubernetes secretfile

secret

问题#2:Kubelet缺少Ceph软件包和配置

kubelet都缺少将CephFS卷挂载到容器所需的apiVersion: v1 kind: Pod metadata: name: cephfs-test spec: containers: - name: cephfs-rw image: kubernetes/pause volumeMounts: - mountPath: "/mnt/cephfs" name: cephfs volumes: - name: cephfs cephfs: monitors: - "<monitor1>:6789" - "<monitor2>:6789" - "<<monitor3>:6789" user: admin # Omit for CephFS mounting error # secretRef: # name: ceph-secret secretFile: "/etc/ceph/user.secret" readOnly: false ceph-fs-common包以及必要的配置文件。以下脚本应对kubelet主/工作代理应用必要的更新:

ceph-common

完整的要点here