diff --git a/examples_test.go b/examples_test.go index e0c18203..e0d9cebc 100644 --- a/examples_test.go +++ b/examples_test.go @@ -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 { diff --git a/glusterfs/README.md b/glusterfs/README.md new file mode 100644 index 00000000..e9d7a7db --- /dev/null +++ b/glusterfs/README.md @@ -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. \ No newline at end of file diff --git a/glusterfs/endpoints/glusterfs-endpoints.json b/glusterfs/endpoints/glusterfs-endpoints.json new file mode 100644 index 00000000..886f7a8c --- /dev/null +++ b/glusterfs/endpoints/glusterfs-endpoints.json @@ -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" + ] +} \ No newline at end of file diff --git a/glusterfs/v1beta3/glusterfs.json b/glusterfs/v1beta3/glusterfs.json new file mode 100644 index 00000000..664a35dc --- /dev/null +++ b/glusterfs/v1beta3/glusterfs.json @@ -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 + } + } + ] + } +} \ No newline at end of file