add kubespray to the XTesting as it provides newer version of kubenetes and can be...
[it/test.git] / XTesting / kubespray / docs / kubernetes-apps / rbd_provisioner.md
1 # RBD Volume Provisioner for Kubernetes 1.5+
2
3 `rbd-provisioner` is an out-of-tree dynamic provisioner for Kubernetes 1.5+.
4 You can use it quickly & easily deploy ceph RBD storage that works almost
5 anywhere.
6
7 It works just like in-tree dynamic provisioner. For more information on how
8 dynamic provisioning works, see [the docs](http://kubernetes.io/docs/user-guide/persistent-volumes/)
9 or [this blog post](http://blog.kubernetes.io/2016/10/dynamic-provisioning-and-storage-in-kubernetes.html).
10
11 ## Development
12
13 Compile the provisioner
14
15 ```console
16 make
17 ```
18
19 Make the container image and push to the registry
20
21 ```console
22 make push
23 ```
24
25 ## Test instruction
26
27 * Start Kubernetes local cluster
28
29 See [Kubernetes](https://kubernetes.io/).
30
31 * Create a Ceph admin secret
32
33 ```bash
34 ceph auth get client.admin 2>&1 |grep "key = " |awk '{print  $3'} |xargs echo -n > /tmp/secret
35 kubectl create secret generic ceph-admin-secret --from-file=/tmp/secret --namespace=kube-system
36 ```
37
38 * Create a Ceph pool and a user secret
39
40 ```bash
41 ceph osd pool create kube 8 8
42 ceph auth add client.kube mon 'allow r' osd 'allow rwx pool=kube'
43 ceph auth get-key client.kube > /tmp/secret
44 kubectl create secret generic ceph-secret --from-file=/tmp/secret --namespace=kube-system
45 ```
46
47 * Start RBD provisioner
48
49 The following example uses `rbd-provisioner-1` as the identity for the instance and assumes kubeconfig is at `/root/.kube`. The identity should remain the same if the provisioner restarts. If there are multiple provisioners, each should have a different identity.
50
51 ```bash
52 docker run -ti -v /root/.kube:/kube -v /var/run/kubernetes:/var/run/kubernetes --privileged --net=host quay.io/external_storage/rbd-provisioner /usr/local/bin/rbd-provisioner -master=http://127.0.0.1:8080 -kubeconfig=/kube/config -id=rbd-provisioner-1
53 ```
54
55 Alternatively, deploy it in kubernetes, see [deployment](deploy/README.md).
56
57 * Create a RBD Storage Class
58
59 Replace Ceph monitor's IP in [examples/class.yaml](examples/class.yaml) with your own and create storage class:
60
61 ```bash
62 kubectl create -f examples/class.yaml
63 ```
64
65 * Create a claim
66
67 ```bash
68 kubectl create -f examples/claim.yaml
69 ```
70
71 * Create a Pod using the claim
72
73 ```bash
74 kubectl create -f examples/test-pod.yaml
75 ```
76
77 ## Acknowledgements
78
79 * This provisioner is extracted from [Kubernetes core](https://github.com/kubernetes/kubernetes) with some modifications for this project.