2015-07-14 00:13:09 +00:00
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
2015-07-16 17:02:26 +00:00
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< img src = "http://kubernetes.io/img/warning.png" alt = "WARNING"
width="25" height="25">
< h2 > PLEASE NOTE: This document applies to the HEAD of the source tree< / h2 >
If you are using a released version of Kubernetes, you should
refer to the docs that go with that version.
2015-12-14 18:37:38 +00:00
<!-- TAG RELEASE_LINK, added by the munger automatically -->
2015-07-16 17:02:26 +00:00
< strong >
2015-11-03 18:17:57 +00:00
The latest release of this document can be found
2016-03-09 02:06:40 +00:00
[here ](http://releases.k8s.io/release-1.2/examples/rbd/README.md ).
2015-07-16 17:02:26 +00:00
Documentation for other releases can be found at
[releases.k8s.io ](http://releases.k8s.io ).
< / strong >
--
2015-07-13 22:15:35 +00:00
2015-07-14 00:13:09 +00:00
<!-- END STRIP_FOR_RELEASE -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
2015-07-17 22:35:41 +00:00
2015-04-07 17:22:23 +00:00
# How to Use it?
2015-07-17 22:35:41 +00:00
2015-04-07 17:22:23 +00:00
Install Ceph on the Kubernetes host. For example, on Fedora 21
2015-09-16 12:52:22 +00:00
# yum -y install ceph-common
2015-07-24 21:52:18 +00:00
2015-04-07 17:22:23 +00:00
If you don't have a Ceph cluster, you can set up a [containerized Ceph cluster ](https://github.com/rootfs/docker-ceph )
2015-07-24 21:52:18 +00:00
2015-04-07 17:22:23 +00:00
Then get the keyring from the Ceph cluster and copy it to */etc/ceph/keyring* .
2015-06-10 22:21:31 +00:00
Once you have installed Ceph and new Kubernetes, you can create a pod based on my examples [rbd.json ](rbd.json ) [rbd-with-secret.json ](rbd-with-secret.json ). In the pod JSON, you need to provide the following information.
2015-04-07 17:22:23 +00:00
- *monitors*: Ceph monitors.
- *pool*: The name of the RADOS pool, if not provided, default *rbd* pool is used.
2015-07-24 21:52:18 +00:00
- *image*: The image name that rbd has created.
2015-04-07 17:22:23 +00:00
- *user*: The RADOS user name. If not provided, default *admin* is used.
- *keyring*: The path to the keyring file. If not provided, default */etc/ceph/keyring* is used.
- *secretName*: The name of the authentication secrets. If provided, *secretName* overrides *keyring* . Note, see below about how to create a secret.
- *fsType*: The filesystem type (ext4, xfs, etc) that formatted on the device.
- *readOnly*: Whether the filesystem is used as readOnly.
# Use Ceph Authentication Secret
2015-09-16 12:52:22 +00:00
If Ceph authentication secret is provided, the secret should be first be *base64 encoded* , then encoded string is placed in a secret yaml. For example, getting Ceph user `kube` 's base64 encoded secret can use the following command:
```console
# grep key /etc/ceph/ceph.client.kube.keyring |awk '{printf "%s", $NF}'|base64
QVFBTWdYaFZ3QkNlRGhBQTlubFBhRnlmVVNhdEdENGRyRldEdlE9PQ==
```
An example yaml is provided [here ](secret/ceph-secret.yaml ). Then post the secret through ```kubectl``` in the following command.
2015-04-07 17:22:23 +00:00
```console
2015-06-05 21:50:11 +00:00
# kubectl create -f examples/rbd/secret/ceph-secret.yaml
2015-07-24 21:52:18 +00:00
```
2015-04-07 17:22:23 +00:00
# Get started
Here are my commands:
```console
2015-06-10 22:21:31 +00:00
# kubectl create -f examples/rbd/rbd.json
2015-06-05 21:50:11 +00:00
# kubectl get pods
2015-04-07 17:22:23 +00:00
```
On the Kubernetes host, I got these in mount output
```console
#mount |grep kub
/dev/rbd0 on /var/lib/kubelet/plugins/kubernetes.io/rbd/rbd/kube-image-foo type ext4 (ro,relatime,stripe=4096,data=ordered)
/dev/rbd0 on /var/lib/kubelet/pods/ec2166b4-de07-11e4-aaf5-d4bed9b39058/volumes/kubernetes.io~rbd/rbdpd type ext4 (ro,relatime,stripe=4096,data=ordered)
```
If you ssh to that machine, you can run `docker ps` to see the actual pod and `docker inspect` to see the volumes used by the container.
2015-07-14 00:13:09 +00:00
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
2015-06-10 22:21:31 +00:00
[![Analytics ](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/rbd/README.md?pixel )]()
2015-07-14 00:13:09 +00:00
<!-- END MUNGE: GENERATED_ANALYTICS -->