implement Ceph FS volume plugin and add to e2e volume test

Signed-off-by: Huamin Chen <hchen@redhat.com>
This commit is contained in:
Huamin Chen
2015-04-09 14:05:24 -04:00
parent 64717962cf
commit fe559f2726
28 changed files with 1184 additions and 1 deletions

68
examples/cephfs/README.md Normal file
View File

@@ -0,0 +1,68 @@
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
<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.
<strong>
The latest 1.0.x release of this document can be found
[here](http://releases.k8s.io/release-1.0/examples/cephfs/README.md).
Documentation for other releases can be found at
[releases.k8s.io](http://releases.k8s.io).
</strong>
--
<!-- END STRIP_FOR_RELEASE -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
# How to Use it?
Install Ceph on the Kubernetes host. For example, on Fedora 21
# yum -y install ceph
If you don't have a Ceph cluster, you can set up a [containerized Ceph cluster](https://github.com/rootfs/ceph_docker)
Then get the keyring from the Ceph cluster and copy it to */etc/ceph/keyring*.
Once you have installed Ceph and new Kubernetes, you can create a pod based on my examples [cephfs.json](cephfs.json) and [cephfs-with-secret.json](cephfs-with-secret.json). In the pod JSON, you need to provide the following information.
- *monitors*: Array of Ceph monitors.
- *user*: The RADOS user name. If not provided, default *admin* is used.
- *secretFile*: The path to the keyring file. If not provided, default */etc/ceph/user.secret* is used.
- *secretRef*: Reference to Ceph authentication secrets. If provided, *secret* overrides *secretFile*.
- *readOnly*: Whether the filesystem is used as readOnly.
Here are the commands:
```console
# create a secret if you want to use Ceph secret instead of secret file
# cluster/kubectl.sh create -f examples/cephfs/secret/ceph-secret.yaml
# cluster/kubectl.sh create -f examples/cephfs/v1beta3/cephfs.json
# cluster/kubectl.sh get pods
```
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.
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/cephfs/README.md?pixel)]()
<!-- END MUNGE: GENERATED_ANALYTICS -->

View File

@@ -0,0 +1,39 @@
{
"apiVersion": "v1",
"id": "cephfs2",
"kind": "Pod",
"metadata": {
"name": "cephfs2"
},
"spec": {
"containers": [
{
"name": "cephfs-rw",
"image": "kubernetes/pause",
"volumeMounts": [
{
"mountPath": "/mnt/cephfs",
"name": "cephfs"
}
]
}
],
"volumes": [
{
"name": "cephfs",
"cephfs": {
"monitors": [
"10.16.154.78:6789",
"10.16.154.82:6789",
"10.16.154.83:6789"
],
"user": "admin",
"secretRef": {
"name": "ceph-secret"
},
"readOnly": true
}
}
]
}
}

View File

@@ -0,0 +1,37 @@
{
"apiVersion": "v1",
"id": "cephfs",
"kind": "Pod",
"metadata": {
"name": "cephfs"
},
"spec": {
"containers": [
{
"name": "cephfs-rw",
"image": "kubernetes/pause",
"volumeMounts": [
{
"mountPath": "/mnt/cephfs",
"name": "cephfs"
}
]
}
],
"volumes": [
{
"name": "cephfs",
"cephfs": {
"monitors": [
"10.16.154.78:6789",
"10.16.154.82:6789",
"10.16.154.83:6789"
],
"user": "admin",
"scretFile": "/etc/ceph/admin.secret",
"readOnly": true
}
}
]
}
}

View File

@@ -0,0 +1,6 @@
apiVersion: v1
kind: Secret
metadata:
name: ceph-secret
data:
key: QVFCMTZWMVZvRjVtRXhBQTVrQ1FzN2JCajhWVUxSdzI2Qzg0SEE9PQ==