Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
Add cephfs deployment rbac yaml files and docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
cofyc committed Dec 21, 2017
1 parent e1568ce commit 5074364
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 35 deletions.
28 changes: 15 additions & 13 deletions ceph/cephfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@

Using Ceph volume client

# Test instruction
## Development

Compile the provisioner
``` console
```console
make
```

Make the container image and push to the registry
``` console
```console
make push
```

## Test instruction

* Start Kubernetes local cluster

See https://kubernetes.io/.

* Create a Ceph admin secret

```bash
Expand All @@ -32,38 +36,36 @@ The following example uses `cephfs-provisioner-1` as the identity for the instan
```bash
docker run -ti -v /root/.kube:/kube -v /var/run/kubernetes:/var/run/kubernetes --privileged --net=host cephfs-provisioner /usr/local/bin/cephfs-provisioner -master=http://127.0.0.1:8080 -kubeconfig=/kube/config -id=cephfs-provisioner-1
```
Alternatively, start a deployment:

```bash
kubectl create -f deployment.yaml
```
Alternatively, deploy it in kubernetes, see [deployment](deploy/README.md).

* Create a CephFS Storage Class

Replace Ceph monitor's IP in [class.yaml](class.yaml) with your own and create storage class:
Replace Ceph monitor's IP in [example/class.yaml](example/class.yaml) with your own and create storage class:

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

* Create a claim

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

* Create a Pod using the claim

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


# Known limitations
## 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.

# Acknowledgement
## Acknowledgement

Inspired by CephFS Manila provisioner and conversation with John Spray
8 changes: 0 additions & 8 deletions ceph/cephfs/ceph-secret-admin.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions ceph/cephfs/configmap.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions ceph/cephfs/deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Deployment

## Table of contents

* [Install without RBAC roles](#install-without-rbac-roles)
* [Install with RBAC roles](#install-with-rbac-roles)

## Install without RBAC roles

```
cd $GOPATH/src/github.com/kubernetes-incubator/external-storage/ceph/cephfs/deploy
kubectl apply -f ./non-rbac
```

## Install with RBAC roles

```
cd $GOPATH/src/github.com/kubernetes-incubator/external-storage/ceph/cephfs/deploy
NAMESPACE=default # change this if you want to deploy it in another namespace
sed -r -i "s/namespace: [^ ]+/namespace: $NAMESPACE/g" ./rbac/clusterrolebinding.yaml
kubectl -n $NAMESPACE apply -f ./rbac
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ spec:
image: "quay.io/external_storage/cephfs-provisioner:latest"
env:
- name: PROVISIONER_NAME
valueFrom:
configMapKeyRef:
key: provisioner.name
name: cephfs-provisioner
value: ceph.com/cephfs
command:
- "/usr/local/bin/cephfs-provisioner"
- "/usr/local/bin/cephfs-provisioner"
args:
- "-id=cephfs-provisioner-1"
- "-id=cephfs-provisioner-1"
20 changes: 20 additions & 0 deletions ceph/cephfs/deploy/rbac/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: cephfs-provisioner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get","create"]
12 changes: 12 additions & 0 deletions ceph/cephfs/deploy/rbac/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: cephfs-provisioner
subjects:
- kind: ServiceAccount
name: cephfs-provisioner
namespace: default
roleRef:
kind: ClusterRole
name: cephfs-provisioner
apiGroup: rbac.authorization.k8s.io
24 changes: 24 additions & 0 deletions ceph/cephfs/deploy/rbac/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: cephfs-provisioner
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: cephfs-provisioner
spec:
containers:
- name: cephfs-provisioner
image: "quay.io/external_storage/cephfs-provisioner:latest"
env:
- name: PROVISIONER_NAME
value: ceph.com/cephfs
command:
- "/usr/local/bin/cephfs-provisioner"
args:
- "-id=cephfs-provisioner-1"
serviceAccount: cephfs-provisioner
4 changes: 4 additions & 0 deletions ceph/cephfs/deploy/rbac/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: cephfs-provisioner
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5074364

Please sign in to comment.