I've successfully deployed a Kubernetes cluster using the docker-multinode configuration as well as a Ceph cluster and am able to mount a CephFS device manually using the following:
sudo mount -t ceph monitor1:6789:/ /ceph -o name=admin,secretfile=/etc/ceph/cephfs.secret
I'm now attempting to launch a pod using the kubernetes example here:
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
When I run:
sudo kubectl create -f cephfs.yml
I am receiving the following error:
Warning FailedMount MountVolume.SetUp failed for volume "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 failed: fork/exec /bin/mount: invalid argument Mounting arguments: 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]
Do the kubernetes manager containers need to have the ceph-fs-common package installed in order to perform a successful mount? I cannot find any further debugging information to determine the cause of the error.
                        
There were a couple of issues that needed fixed in order to successfully mount a CephFS volume in kubernetes. Keep in mind I've deployed Kubernetes 1.4.6 using the kube-deploy docker multinode configuration.
Issue #1: Mount command Fails using Kubernetes secrets
When examining the error above more closely, I found that Kubernetes encrypts my Ceph secret with characters that are interpreted as newlines. As a result, the kubelet fails when attempting to mount the file system.
To workaround, I configured my YAML to use a Ceph
secretfileinstead of a Kubernetessecret:Issue #2: Kubelet Missing Ceph Packages and Configuration
The kubelets were all missing the
ceph-fs-commonandceph-commonpackages required to mount CephFS volumes to containers as well as the necessary configuration files. The following script should applies the necessary updates to the kubelet master/worker agents:Full gist here