Skip to content

Commit

Permalink
add cephfs provisioner
Browse files Browse the repository at this point in the history
Signed-off-by: Huamin Chen <[email protected]>
  • Loading branch information
rootfs committed Mar 7, 2017
1 parent 920acab commit cbaf24f
Show file tree
Hide file tree
Showing 10 changed files with 748 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cephfs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM centos:7
RUN rpm -Uvh https://download.ceph.com/rpm-jewel/el7/noarch/ceph-release-1-1.el7.noarch.rpm
RUN yum install -y epel-release
RUN yum install -y ceph-common python-cephfs
ADD cephfs-provisioner /usr/local/bin/cephfs-provisioner
ADD cephfs_provisioner/cephfs_provisioner.py /usr/local/bin/cephfs_provisioner
CMD chmod x+o /usr/local/bin/cephfs_provisioner
54 changes: 54 additions & 0 deletions cephfs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# CephFS Volume Provisioner for Kubernetes 1.5+

Using Ceph volume client

# Test instruction

* Build cephfs-provisioner and container image

```bash
go build cephfs-provisioner.go
docker build -t cephfs-provisioner .
```

* Start Kubernetes local cluster

* Create a Ceph admin secret

```bash
ceph auth get client.admin 2>&1 |grep "key = " |a^C '{print $3'} |xargs echo -n > /tmp/secret
kubectl create secret generic ceph-secret-admin --from-file=/tmp/secret --namespace=kube-system
```

* Start CephFS provisioner

Assume kubeconfig is at `/root/.kube`:

```bash
docker run -ti -v /root/.kube:/kube --privileged --net=host cephfs-provisioner /usr/local/bin/cephfs-provisioner -master=http://127.0.0.1:8080 -kubeconfig=/kube/config
```

* Create a CephFS Storage Class

```bash
kubectl create -f class.yaml
```

* Create a claim

```bash
kubectl create -f claim.yaml
```

* Create a Pod using the claim

```bash
kubectl create -f test-pod.yaml
```


# Known limitations

* Kernel CephFS doesn't work with SELinux, setting SELinux label in Pod's securityContext will not work.
* Kernel CephFS doesn't support quota or capacity, capacity requested by PVC is not enforced or validated.
* Currently each Ceph user created by the provisioner has `allow r` MDS cap to permit CephFS mount.
8 changes: 8 additions & 0 deletions cephfs/ceph-secret-admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: ceph-secret-admin
type: "kubernetes.io/cephfs"
data:
#Please note this value is base64 encoded.
key: QVFDTXBIOVlNNFExQmhBQVhHTlF5eU9uZThac1hxV0dvbi9kSVE9PQ==
Loading

0 comments on commit cbaf24f

Please sign in to comment.