From bb1f7b68e7cde6f57e89bf3fa669ccdf72edb822 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 19 Jul 2016 19:40:49 -0500 Subject: [PATCH 1/8] updated mistake intro and documented changes made to ansible configurate configuration files: inventory and all.yml --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b57127..5977981 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ #Cluster Setup -This guide is for setting up a kubernetes enabled cluster that is enabled with glusterfs and an installation of gogs +This guide is for setting up a kubernetes enabled cluster that is enabled with glusterfs ## Base OS @@ -47,7 +47,21 @@ Follow guide here - http://kubernetes.io/v1.1/docs/getting-started-guides/fedora Edit inventory $ vim inventory + replace text with: + [masters] + master + + [etcd] + master + + [nodes] + master + worker00 + $ vim ~/contrib/ansible/group_vars/all.yml + replace line 17 with: + ansible_ssh_user: root + $ cd ~/contrib/ansible/ $ ./setup.sh From c51d483682514f6e289e553d47e1ab8004045095 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 20 Jul 2016 12:21:10 -0500 Subject: [PATCH 2/8] changed formatting of Rename hosts --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5977981..c5306bf 100644 --- a/README.md +++ b/README.md @@ -16,18 +16,16 @@ Create root & userspace accounts ## Node setup ### Clone installation ### Rename hosts -Rename /etc/hostname to: -* master.local -* worker00.local +On each node `vim /etc/hostname` and change the hostname entry to `master.local` and `worker00.local` for the master and worker nodes respectively Reboot and check if master and worker are reachable from each other: -* from master +From master ``` - $ ping worker00 +$ ping worker00 ``` -* from worker00 +From worker00 ``` - $ ping master +$ ping master ``` ### GlusterFS From 86a49bc2565666e02a181cf13a48e46b49975e5c Mon Sep 17 00:00:00 2001 From: root Date: Wed, 20 Jul 2016 12:23:12 -0500 Subject: [PATCH 3/8] changed formatting again --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c5306bf..a89bfef 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Create root & userspace accounts On each node `vim /etc/hostname` and change the hostname entry to `master.local` and `worker00.local` for the master and worker nodes respectively Reboot and check if master and worker are reachable from each other: + From master ``` $ ping worker00 From fb69da16ea94363cba2ea28fed618007b15ad266 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 31 Jul 2016 17:29:18 -0500 Subject: [PATCH 4/8] adding documentation for gluster vol setup --- gluster_vol_examples/glusterfs-endpoints.json | 33 +++++++++++++++++++ gluster_vol_examples/glusterfs-pod.json | 31 +++++++++++++++++ gluster_vol_examples/glusterfs-services.json | 12 +++++++ 3 files changed, 76 insertions(+) create mode 100644 gluster_vol_examples/glusterfs-endpoints.json create mode 100644 gluster_vol_examples/glusterfs-pod.json create mode 100644 gluster_vol_examples/glusterfs-services.json diff --git a/gluster_vol_examples/glusterfs-endpoints.json b/gluster_vol_examples/glusterfs-endpoints.json new file mode 100644 index 0000000..4ebc237 --- /dev/null +++ b/gluster_vol_examples/glusterfs-endpoints.json @@ -0,0 +1,33 @@ +{ + "kind": "Endpoints", + "apiVersion": "v1", + "metadata": { + "name": "glusterfs-cluster" + }, + "subsets": [ + { + "addresses": [ + { + "ip": "192.168.1.68" + } + ], + "ports": [ + { + "port": 1 + } + ] + }, + { + "addresses": [ + { + "ip": "192.168.1.69" + } + ], + "ports": [ + { + "port": 1 + } + ] + } + ] +} diff --git a/gluster_vol_examples/glusterfs-pod.json b/gluster_vol_examples/glusterfs-pod.json new file mode 100644 index 0000000..78600ea --- /dev/null +++ b/gluster_vol_examples/glusterfs-pod.json @@ -0,0 +1,31 @@ +{ + "apiVersion": "v1", + "kind": "Pod", + "metadata": { + "name": "glusterfs" + }, + "spec": { + "containers": [ + { + "name": "glusterfs", + "image": "kubernetes/pause", + "volumeMounts": [ + { + "mountPath": "/mnt/mountpoint", + "name": "glusterfsvol" + } + ] + } + ], + "volumes": [ + { + "name": "glusterfsvol", + "glusterfs": { + "endpoints": "glusterfs-cluster", + "path": "gv0", + "readOnly": false + } + } + ] + } +} diff --git a/gluster_vol_examples/glusterfs-services.json b/gluster_vol_examples/glusterfs-services.json new file mode 100644 index 0000000..79139fe --- /dev/null +++ b/gluster_vol_examples/glusterfs-services.json @@ -0,0 +1,12 @@ +{ + "kind": "Service", + "apiVersion": "v1", + "metadata": { + "name": "glusterfs-cluster" + }, + "spec": { + "ports": [ + {"port": 1} + ] + } +} From 83f5ece7a74c2335bfb9e8ff0dec7ad6ecc4d978 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 31 Jul 2016 18:19:17 -0500 Subject: [PATCH 5/8] updated readme with instructions to setup glustervolume --- README.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/README.md b/README.md index a89bfef..48282f2 100644 --- a/README.md +++ b/README.md @@ -64,4 +64,83 @@ Edit inventory $ cd ~/contrib/ansible/ $ ./setup.sh +### Attach Gluster Volume to Container +These instructions can be used to provide a gluster volume to a container + +## Create endpoints + +Write a spec file for the endpoints. Use the sample [glusterfs-endpoints.json](https://github.com/shuaib88/cluster_setup/blob/initialSetup/gluster_vol_examples/glusterfs-endpoints.json) as a guide + +Ping each node and obtain the IP address, your spec file should use the IPv4 format to declare each node. For example: + +``` + { + "addresses": [ + { + "ip": "192.168.1.68" + } + ], + "ports": [ + { + "port": 1 + } + ] + } +``` + +Create the endpoints, +``` +$ kubectl create -f glusterfs-endpoints.json +``` +Verify that the endpoints are successfully created by running +``` +$ kubectl get endpoints +NAME ENDPOINTS +glusterfs-cluster 192.168.1.68:1,192.168.1.69:1 +``` +Create a service for these endpoints so that they will be persistent. See [glusterfs-service.json](https://github.com/shuaib88/cluster_setup/blob/initialSetup/gluster_vol_examples/glusterfs-services.json) for details +``` +$ kubectl create -f glusterfs-service.json +``` + +## Create a POD + +The following volume spec in (glusterfs-pod.json) illustrates a sample configuration. +``` + { + "name": "glusterfsvol", + "glusterfs": { + "endpoints": "glusterfs-cluster", + "path": "gv0", + "readOnly": false + } + } +``` +The parameters are explained as follows: +-**endpoints** the endpoints name we defined in our gluster-endpoints.json service. The pod will randomly pick one of the endpoints to mount. +-**path** is the Glusterfs volume name. +-**readOnly** is the boolean which sets the mountpoint as readOnly or readWrite. + +Create a pod that has a container using Glusterfs volume +``` +$ kubectl create -f glusterfs-pod.json +``` + +Verify the pod is running +``` +$ kubectl get pods +NAME READY STATUS RESTARTS AGE +glusterfs 1/1 Running 0 7h + +$ kubectl get pods glusterfs --template '{{.status.hostIP}}{{"\n"}}' +192.168.1.68 +``` + +Check if the Glusterfs volume is mounted. ssh into host and run 'mount' +``` +$ mount | grep gv0 +192.168.1.68:gv0 on /var/lib/kubelet/pods/68c71672-5733-11e6-90eb-08002713a57e/volumes/kubernetes.io~glusterfs/glusterfsvol type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072) +``` + +You can also run `docker ps` on the host to see the actual container From 821f7f3702830b270cc9f99553647b9b7022c641 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 31 Jul 2016 18:22:19 -0500 Subject: [PATCH 6/8] update headings --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 48282f2..ecb2606 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Edit inventory These instructions can be used to provide a gluster volume to a container -## Create endpoints +#### Create endpoints Write a spec file for the endpoints. Use the sample [glusterfs-endpoints.json](https://github.com/shuaib88/cluster_setup/blob/initialSetup/gluster_vol_examples/glusterfs-endpoints.json) as a guide @@ -104,7 +104,7 @@ Create a service for these endpoints so that they will be persistent. See [glust $ kubectl create -f glusterfs-service.json ``` -## Create a POD +#### Create a POD The following volume spec in (glusterfs-pod.json) illustrates a sample configuration. ``` From 893ee662493efd3ba039a048eaf1d2b0d2790a68 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 31 Jul 2016 18:32:05 -0500 Subject: [PATCH 7/8] update headings --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ecb2606..b3a317b 100644 --- a/README.md +++ b/README.md @@ -66,13 +66,13 @@ Edit inventory ### Attach Gluster Volume to Container -These instructions can be used to provide a gluster volume to a container +These instructions can be used to provide a gluster volume to a container. Instruction attribution [here](https://github.com/kubernetes/kubernetes/tree/master/examples/volumes/glusterfs) #### Create endpoints Write a spec file for the endpoints. Use the sample [glusterfs-endpoints.json](https://github.com/shuaib88/cluster_setup/blob/initialSetup/gluster_vol_examples/glusterfs-endpoints.json) as a guide -Ping each node and obtain the IP address, your spec file should use the IPv4 format to declare each node. For example: +Ping each node and obtain the IP address. Your spec file should use the IPv4 format to declare each node. For example: ``` { @@ -89,7 +89,7 @@ Ping each node and obtain the IP address, your spec file should use the IPv4 for } ``` -Create the endpoints, +Create the endpoints ``` $ kubectl create -f glusterfs-endpoints.json ``` @@ -106,7 +106,7 @@ $ kubectl create -f glusterfs-service.json #### Create a POD -The following volume spec in (glusterfs-pod.json) illustrates a sample configuration. +The following volume spec in [glusterfs-pod.json](https://github.com/shuaib88/cluster_setup/blob/initialSetup/gluster_vol_examples/glusterfs-pod.json) illustrates a sample configuration. ``` { "name": "glusterfsvol", @@ -118,9 +118,9 @@ The following volume spec in (glusterfs-pod.json) illustrates a sample configura } ``` The parameters are explained as follows: --**endpoints** the endpoints name we defined in our gluster-endpoints.json service. The pod will randomly pick one of the endpoints to mount. --**path** is the Glusterfs volume name. --**readOnly** is the boolean which sets the mountpoint as readOnly or readWrite. +- **endpoints** the endpoints name we defined in our gluster-endpoints.json service. The pod will randomly pick one of the endpoints to mount. +- **path** is the Glusterfs volume name. +- **readOnly** is the boolean which sets the mountpoint as readOnly or readWrite. Create a pod that has a container using Glusterfs volume ``` From f913f9c8dfcbeff63799e7520b970bd5e9407357 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 31 Jul 2016 19:02:45 -0500 Subject: [PATCH 8/8] update formatting --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3a317b..890c947 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ The following volume spec in [glusterfs-pod.json](https://github.com/shuaib88/cl } ``` The parameters are explained as follows: -- **endpoints** the endpoints name we defined in our gluster-endpoints.json service. The pod will randomly pick one of the endpoints to mount. +- **endpoints** the endpoints name we defined in our endpoints service. The pod will randomly pick one of the endpoints to mount. - **path** is the Glusterfs volume name. - **readOnly** is the boolean which sets the mountpoint as readOnly or readWrite.