implement glusterfs volume plugin

Signed-off-by: Huamin Chen <hchen@redhat.com>
This commit is contained in:
Huamin Chen 2015-03-26 14:53:21 -04:00
parent fd874e03cb
commit dab4f65e96
4 changed files with 95 additions and 0 deletions

View File

@ -181,6 +181,9 @@ func TestExampleObjectSchemas(t *testing.T) {
"../examples/iscsi/v1beta3": {
"iscsi": &api.Pod{},
},
"../examples/glusterfs/v1beta3": {
"glusterfs": &api.Pod{},
},
}
for path, expected := range cases {

47
glusterfs/README.md Normal file
View File

@ -0,0 +1,47 @@
## Glusterfs
[Glusterfs](http://www.gluster.org) is an open source scale-out filesystem. These examples provide information about how to allow containers use Glusterfs volumes.
The example assumes that the Glusterfs client package is installed on all nodes.
### Prerequisites
Install Glusterfs client package on the Kubernetes hosts.
### Create a POD
The following *volume* spec illustrates a sample configuration.
```js
{
"name": "glusterfsvol",
"glusterfs": {
"endpoints": "glusterfs-cluster",
"path": "kube_vol",
"readOnly": true
}
}
```
The parameters are explained as the followings.
- **endpoints** is endpoints name that represents a Gluster cluster configuration. *kubelet* is optimized to avoid mount storm, it will randomly pick one from the endpoints to mount. If this host is unresponsive, the next Gluster host in the endpoints is automatically selected.
- **path** is the Glusterfs volume name.
- **readOnly** is the boolean that sets the mountpoint readOnly or readWrite.
Detailed POD and Gluster cluster endpoints examples can be found at [v1beta3/](v1beta3/) and [endpoints/](endpoints/)
```shell
# create gluster cluster endpoints
$ kubectl create -f examples/glusterfs/endpoints/glusterfs-endpoints.json
# create a container using gluster volume
$ kubectl create -f examples/glusterfs/v1beta3/glusterfs.json
```
Once that's up you can list the pods and endpoint in the cluster, to verify that the master is running:
```shell
$ kubectl get endpoints
$ kubectl get pods
```
If you ssh to that machine, you can run `docker ps` to see the actual pod and `mount` to see if the Glusterfs volume is mounted.

View File

@ -0,0 +1,13 @@
{
"apiVersion": "v1beta1",
"id": "glusterfs-cluster",
"kind": "Endpoints",
"metadata": {
"name": "glusterfs-cluster"
},
"Endpoints": [
"10.16.154.81:0",
"10.16.154.82:0",
"10.16.154.83:0"
]
}

View File

@ -0,0 +1,32 @@
{
"apiVersion": "v1beta3",
"id": "glusterfs",
"kind": "Pod",
"metadata": {
"name": "glusterfs"
},
"spec": {
"containers": [
{
"name": "glusterfs",
"image": "kubernetes/pause",
"volumeMounts": [
{
"mountPath": "/mnt/glusterfs",
"name": "glusterfsvol"
}
]
}
],
"volumes": [
{
"name": "glusterfsvol",
"glusterfs": {
"endpoints": "glusterfs-cluster",
"path": "kube_vol",
"readOnly": true
}
}
]
}
}