├── README.md ├── gluster-endpoint └── gluster-endpoints.yaml ├── gluster-pod └── gluster-pod.yaml ├── gluster-pv └── gluster-pv.yaml ├── gluster-pvc ├── gluster-pvc.json └── gluster-pvc.yaml ├── gluster-service └── gluster-service.yaml └── gluster-template ├── gluster-daemonset-template.json ├── gluster-template.json └── gluster-template.yaml /README.md: -------------------------------------------------------------------------------- 1 | 2 | There are different ways to deploy and use GlusterFS in Kubernetes/openshift setup. 3 | 4 | ### Deploying GlusterFS Pod: 5 | 6 | GlusterFS pods can be deployed in Kubernetes/Openshift, so that Gluster Nodes are deployed in containers and it can provide persistent storage for Openshift/Kubernetes setup. 7 | 8 | 9 | 10 | The examples files in this repo are used for this demo. 11 | 12 | Step 1: Create GlusterFS pod 13 | 14 | ~~~ 15 | [root@atomic-node2 gluster_pod]# oc create -f gluster-1.yaml 16 | ~~~ 17 | Step 2: Get details about the GlusterFS pod. 18 | 19 | ~~~ 20 | [root@atomic-node2 gluster_pod]# oc describe pod gluster-1 21 | Name: gluster-1 22 | Namespace: default 23 | Image(s): gluster/gluster-centos 24 | Node: atomic-node1/10.70.43.174 25 | Start Time: Tue, 17 May 2016 10:19:17 +0530 26 | Labels: name=gluster-1 27 | Status: Running 28 | Reason: 29 | Message: 30 | IP: 10.70.43.174 31 | Replication Controllers: 32 | Containers: 33 | glusterfs: 34 | Container ID: docker://ff8f4af700d725dfe0e08939ec011c34ddf9dedc7204e0ced1cc355a56150742 35 | Image: gluster/gluster-centos 36 | Image ID: docker://033de9c44a8aabde55ce8a2b751ccf5bc345fdb534ea30e79a8fa70b82dc7761 37 | QoS Tier: 38 | cpu: BestEffort 39 | memory: BestEffort 40 | State: Running 41 | Started: Tue, 17 May 2016 10:20:35 +0530 42 | Ready: True 43 | Restart Count: 0 44 | Environment Variables: 45 | Conditions: 46 | Type Status 47 | Ready True 48 | Volumes: 49 | brickpath: 50 | Type: HostPath (bare host directory volume) 51 | Path: /mnt/brick1 52 | default-token-72d89: 53 | Type: Secret (a secret that should populate this volume) 54 | SecretName: default-token-72d89 55 | Events: 56 | FirstSeen LastSeen Count From SubobjectPath Reason Message 57 | ───────── ──────── ───── ──── ───────────── ────── ─────── 58 | 1m 1m 1 {scheduler } Scheduled Successfully assigned gluster-1 to atomic-node1 59 | 1m 1m 1 {kubelet atomic-node1} implicitly required container POD Pulled Container image "openshift3/ose-pod:v3.1.1.6" already present on machine 60 | 1m 1m 1 {kubelet atomic-node1} implicitly required container POD Created Created with docker id f55ce55e6ea3 61 | 1m 1m 1 {kubelet atomic-node1} implicitly required container POD Started Started with docker id f55ce55e6ea3 62 | 1m 1m 1 {kubelet atomic-node1} spec.containers{glusterfs} Pulling pulling image "gluster/gluster-centos" 63 | 8s 8s 1 {kubelet atomic-node1} spec.containers{glusterfs} Pulled Successfully pulled image "gluster/gluster-centos" 64 | 8s 8s 1 {kubelet atomic-node1} spec.containers{glusterfs} Created Created with docker id ff8f4af700d7 65 | 8s 8s 1 {kubelet atomic-node1} spec.containers{glusterfs} Started Started with docker id ff8f4af700d7 66 | 67 | ~~~ 68 | 69 | From above logs you can see it pulled 'gluster/gluster-centos' container image and depoyed containers from it. 70 | 71 | ~~~ 72 | [root@atomic-node2 gluster_pod]# oc get pods 73 | NAME READY STATUS RESTARTS AGE 74 | gluster-1 1/1 Running 0 1m 75 | ~~~ 76 | 77 | Examine the container and make sure it has a running GlusterFS deamon. 78 | 79 | ~~~ 80 | 81 | [root@atomic-node2 gluster_pod]# oc exec -ti gluster-1 /bin/bash 82 | [root@atomic-node1 /]# 83 | [root@atomic-node1 /]# 84 | [root@atomic-node1 /]# ps aux 85 | USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 86 | root 1 0.4 0.0 40780 2920 ? Ss 04:50 0:00 /usr/sbin/init 87 | root 20 0.3 0.0 36816 4272 ? Ss 04:50 0:00 /usr/lib/syste 88 | root 21 0.0 0.0 118476 1332 ? Ss 04:50 0:00 /usr/sbin/lvme 89 | root 37 0.0 0.0 101344 1228 ? Ssl 04:50 0:00 /usr/sbin/gssp 90 | rpc 44 0.1 0.0 64904 1052 ? Ss 04:50 0:00 /sbin/rpcbind 91 | root 209 0.1 0.1 364716 13444 ? Ssl 04:50 0:00 /usr/sbin/glus 92 | root 341 1.1 0.0 13368 1964 ? Ss 04:51 0:00 /bin/bash 93 | root 354 0.0 0.0 49020 1820 ? R+ 04:51 0:00 ps aux 94 | [root@atomic-node1 /]# service glusterd status 95 | Redirecting to /bin/systemctl status glusterd.service 96 | ● glusterd.service - GlusterFS, a clustered file-system server 97 | Loaded: loaded (/usr/lib/systemd/system/glusterd.service; enabled; vendor preset: disabled) 98 | Active: active (running) since Tue 2016-05-17 04:50:41 UTC; 35s ago 99 | Process: 208 ExecStart=/usr/sbin/glusterd -p /var/run/glusterd.pid --log-level $LOG_LEVEL $GLUSTERD_OPTIONS (code=exited, status=0/SUCCESS) 100 | Main PID: 209 (glusterd) 101 | CGroup: /system.slice/docker-ff8f4af700d725dfe0e08939ec011c34ddf9dedc7204e0ced1cc355a56150742.scope/system.slice/glusterd.service 102 | └─209 /usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO... 103 | ‣ 209 /usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO... 104 | 105 | May 17 04:50:36 atomic-node1 systemd[1]: Starting Gluste... 106 | May 17 04:50:41 atomic-node1 systemd[1]: Started Gluster... 107 | Hint: Some lines were ellipsized, use -l to show in full. 108 | [root@atomic-node1 /]# gluster --version 109 | glusterfs 3.7.9 built on Mar 20 2016 03:19:49 110 | Repository revision: git://git.gluster.com/glusterfs.git 111 | Copyright (c) 2006-2011 Gluster Inc. 112 | GlusterFS comes with ABSOLUTELY NO WARRANTY. 113 | You may redistribute copies of GlusterFS under the terms of the GNU General Public License. 114 | [root@atomic-node1 /]# 115 | 116 | [root@atomic-node1 /]# mount |grep mnt 117 | /dev/mapper/atomic-node1-root on /mnt/brick1 type xfs (rw,relatime,seclabel,attr2,inode64,noquota) 118 | [root@atomic-node1 /]# ip a 119 | 1: lo: mtu 65536 qdisc noqueue state UNKNOWN 120 | link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 121 | inet 127.0.0.1/8 scope host lo 122 | valid_lft forever preferred_lft forever 123 | inet6 ::1/128 scope host 124 | valid_lft forever preferred_lft forever 125 | 2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 126 | link/ether 52:54:00:f3:4b:e3 brd ff:ff:ff:ff:ff:ff 127 | inet 10.70.43.174/22 brd 10.70.43.255 scope global dynamic eth0 128 | valid_lft 62555sec preferred_lft 62555sec 129 | inet6 2620:52:0:4628:5054:ff:fef3:4be3/64 scope global noprefixroute dynamic 130 | valid_lft 2591620sec preferred_lft 604420sec 131 | inet6 fe80::5054:ff:fef3:4be3/64 scope link 132 | valid_lft forever preferred_lft forever 133 | 3: ovs-system: mtu 1500 qdisc noop state DOWN 134 | link/ether c6:b6:3b:94:a7:88 brd ff:ff:ff:ff:ff:ff 135 | 5: br0: mtu 1450 qdisc noop state DOWN 136 | link/ether 4a:5f:b9:50:89:46 brd ff:ff:ff:ff:ff:ff 137 | 7: lbr0: mtu 1450 qdisc noqueue state UP 138 | link/ether f2:2c:ed:a7:d1:6b brd ff:ff:ff:ff:ff:ff 139 | inet 10.1.3.1/24 scope global lbr0 140 | valid_lft forever preferred_lft forever 141 | inet6 fe80::d070:feff:fe82:afe4/64 scope link 142 | valid_lft forever preferred_lft forever 143 | 8: vovsbr@vlinuxbr: mtu 1450 qdisc pfifo_fast master ovs-system state UP 144 | link/ether 96:38:12:0f:c2:e2 brd ff:ff:ff:ff:ff:ff 145 | inet6 fe80::9438:12ff:fe0f:c2e2/64 scope link 146 | valid_lft forever preferred_lft forever 147 | 9: vlinuxbr@vovsbr: mtu 1450 qdisc pfifo_fast master lbr0 state UP 148 | link/ether f2:2c:ed:a7:d1:6b brd ff:ff:ff:ff:ff:ff 149 | inet6 fe80::f02c:edff:fea7:d16b/64 scope link 150 | valid_lft forever preferred_lft forever 151 | 10: tun0: mtu 1450 qdisc noqueue state UNKNOWN 152 | link/ether b2:a8:c0:73:3a:be brd ff:ff:ff:ff:ff:ff 153 | inet 10.1.3.1/24 scope global tun0 154 | valid_lft forever preferred_lft forever 155 | inet6 fe80::b0a8:c0ff:fe73:3abe/64 scope link 156 | valid_lft forever preferred_lft forever 157 | [root@atomic-node1 /]# 158 | [root@atomic-node1 /]# cat /etc/redhat-release 159 | CentOS Linux release 7.2.1511 (Core) 160 | [root@atomic-node1 /]# 161 | 162 | 163 | [root@atomic-node2 gluster_pod]# oc get pods 164 | NAME READY STATUS RESTARTS AGE 165 | gluster-1 1/1 Running 0 3m 166 | [root@atomic-node2 gluster_pod]# 167 | 168 | 169 | 170 | ~~~ 171 | 172 | ### Deploying GlusterFS PV, PVC, SERVICE and ENDPOINT 173 | 174 | Refer # http://tinyurl.com/hne8g7o 175 | 176 | ### Deploying GlusterFS Template 177 | 178 | 179 | 180 | 181 | 182 | ~~~ 183 | [root@atomic-node2~]# oc create -f gluster-template.json 184 | template "gluster1" created 185 | [root@atomic-node2~]# oc process gluster1 -v NAME=gluster1 -v HOSTNAME=atomic-node2|oc create -f - 186 | deploymentconfig "gluster1" created 187 | [root@atomic-node2~]# oc get pods 188 | NAME READY STATUS RESTARTS AGE 189 | gluster1-1-deploy 1/1 Running 0 3s 190 | [root@atomic-node2~]# oc describe pod gluster1-1-deploy 191 | Name: gluster1-1-deploy 192 | Namespace: default 193 | Image(s): openshift3/ose-deployer:v3.1.1.6 194 | Node: atomic-node2/10.70.43.183 195 | Start Time: Thu, 19 May 2016 13:32:34 +0530 196 | Labels: openshift.io/deployer-pod-for.name=gluster1-1 197 | Status: Running 198 | Reason: 199 | Message: 200 | IP: 10.1.0.19 201 | Replication Controllers: 202 | Containers: 203 | deployment: 204 | Container ID: docker://e6ffd0d1f369ad603803ed118e11b1855714ea57b47034b436b4325d7b67e00a 205 | Image: openshift3/ose-deployer:v3.1.1.6 206 | Image ID: docker://83d05f2929e92a7e8e9b62b33e408c1d83c3fe0e0de014475cb01c7d0fac7fb0 207 | QoS Tier: 208 | cpu: BestEffort 209 | memory: BestEffort 210 | State: Running 211 | Started: Thu, 19 May 2016 13:32:36 +0530 212 | Ready: True 213 | Restart Count: 0 214 | Environment Variables: 215 | KUBERNETES_MASTER: https://atomic-node2:8443 216 | OPENSHIFT_MASTER: https://atomic-node2:8443 217 | BEARER_TOKEN_FILE: /var/run/secrets/kubernetes.io/serviceaccount/token 218 | OPENSHIFT_CA_DATA: -----BEGIN CERTIFICATE----- 219 | MIIC5jCCAdCgAwIBAgIBATALBgkqhkiG9w0BAQswJjEkMCIGA1UEAwwbb3BlbnNo 220 | aWZ0LXNpZ25lckAxNDU2ODIwMTYyMB4XDTE2MDMwMTA4MTYwMloXDTIxMDIyODA4 221 | MTYwM1owJjEkMCIGA1UEAwwbb3BlbnNoaWZ0LXNpZ25lckAxNDU2ODIwMTYyMIIB 222 | IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3XRxVLp7K/RJp2jezD3675Af 223 | pLPbn4C4ZRDUM5v6gGF3mPboii40DYPY9ZxmX0fhnzidOp6jI3tmVXSsuBQszGi9 224 | lNAvr+eqoz2Wf44EQhQ1+AtH6VcSFaGjGoMpkteskjuj9WV7qlGwS9uoql3ZwkEC 225 | l8G+D95/opn691McWBe0KDebgl/Rpu+xk8T3ZR1rYSU4p3v0jD4Ir8bitiC/22wt 226 | lq6f5UvhPU8jm+Y8xpaeFagnzZAgt+szycTymTIDQ1f66Qc/cIdS/WKzMqjyp5W1 227 | 6GKoNGrJm5KhqmqLnFOJ5Y9tzWCCbfTMHNo+fLWTpsk8uK3IR2cQRTp1hxpUBQID 228 | AQABoyMwITAOBgNVHQ8BAf8EBAMCAKQwDwYDVR0TAQH/BAUwAwEB/zALBgkqhkiG 229 | 9w0BAQsDggEBAA310d2eeAApVoKNisDWTvPiuy9OIfVIyTe+Xcs63XM6vLVkNSSv 230 | JKK/+HWdLF7AV4qlFY2azHsqThqwtReMKVBGo5CuCb7nOl6pTtGt15muFVIxccT0 231 | m4mR0A49wpmCBB5DJA5sLA0RB8nA1pf8Q50KqMpUVIU6scoWAjHNHt+jHKVVXMSY 232 | 1enpa2CDeDW60uArAA/5UXvSW70bplF+EizlCfZ/XnAD5JiyZVNbptGKKja3eXrw 233 | ZVkBBkN4IqXjSS98xur+LdQ4MS4K/S9xHXN1lhaWEQboiJD8cNOF0+XyWY9UCcUB 234 | vIc6dUlEFaJaKB/JNUowfywiIQ/ABeFaiZ8= 235 | -----END CERTIFICATE----- 236 | 237 | OPENSHIFT_DEPLOYMENT_NAME: gluster1-1 238 | OPENSHIFT_DEPLOYMENT_NAMESPACE: default 239 | Conditions: 240 | Type Status 241 | Ready True 242 | Volumes: 243 | deployer-token-tvmcp: 244 | Type: Secret (a secret that should populate this volume) 245 | SecretName: deployer-token-tvmcp 246 | Events: 247 | FirstSeen LastSeen Count From SubobjectPath Reason Message 248 | ───────── ──────── ───── ──── ───────────── ────── ─────── 249 | 12s 12s 1 {scheduler } Scheduled Successfully assigned gluster1-1-deploy to atomic-node2 250 | 11s 11s 1 {kubelet atomic-node2} implicitly required container POD Pulled Container image "openshift3/ose-pod:v3.1.1.6" already present on machine 251 | 11s 11s 1 {kubelet atomic-node2} implicitly required container POD Created Created with docker id 84751e8ffe5e 252 | 10s 10s 1 {kubelet atomic-node2} implicitly required container POD Started Started with docker id 84751e8ffe5e 253 | 10s 10s 1 {kubelet atomic-node2} spec.containers{deployment} Pulled Container image "openshift3/ose-deployer:v3.1.1.6" already present on machine 254 | 10s 10s 1 {kubelet atomic-node2} spec.containers{deployment} Created Created with docker id e6ffd0d1f369 255 | 10s 10s 1 {kubelet atomic-node2} spec.containers{deployment} Started Started with docker id e6ffd0d1f369 256 | 257 | 258 | [root@atomic-node2~]# oc get pods 259 | NAME READY STATUS RESTARTS AGE 260 | gluster1-1-deploy 1/1 Running 0 16s 261 | gluster1-1-k1dv6 1/1 Running 0 12s 262 | 263 | [root@atomic-node2~]# oc get pods 264 | NAME READY STATUS RESTARTS AGE 265 | gluster1-1-k1dv6 1/1 Running 0 32s 266 | [root@atomic-node2~]# oc describe pod gluster1-1-k1dv6 267 | Name: gluster1-1-k1dv6 268 | Namespace: default 269 | Image(s): gluster/gluster-centos 270 | Node: atomic-node2/10.70.43.183 271 | Start Time: Thu, 19 May 2016 13:32:38 +0530 272 | Labels: deployment=gluster1-1,deploymentconfig=gluster1,name=gluster1 273 | Status: Running 274 | Reason: 275 | Message: 276 | IP: 10.1.0.20 277 | Replication Controllers: gluster1-1 (1/1 replicas created) 278 | Containers: 279 | glusterfs: 280 | Container ID: docker://12432af860908e9eab3b1d64d8abb4654bf5d23baa787389a3aecbf30308b63a 281 | Image: gluster/gluster-centos 282 | Image ID: docker://7dd2be8087cbc54bcac76a2f220d6f0cef7992dc6966cdf52611d12f7e01a823 283 | QoS Tier: 284 | cpu: BestEffort 285 | memory: BestEffort 286 | State: Running 287 | Started: Thu, 19 May 2016 13:32:39 +0530 288 | Ready: True 289 | Restart Count: 0 290 | Environment Variables: 291 | Conditions: 292 | Type Status 293 | Ready True 294 | Volumes: 295 | glusterfs-etc: 296 | Type: HostPath (bare host directory volume) 297 | Path: /etc/glusterfs 298 | glusterfs-logs: 299 | Type: HostPath (bare host directory volume) 300 | Path: /var/log/glusterfs 301 | glusterfs-config: 302 | Type: HostPath (bare host directory volume) 303 | Path: /var/lib/glusterd 304 | glusterfs-dev: 305 | Type: HostPath (bare host directory volume) 306 | Path: /dev 307 | glusterfs-cgroup: 308 | Type: HostPath (bare host directory volume) 309 | Path: /sys/fs/cgroup 310 | default-token-72d89: 311 | Type: Secret (a secret that should populate this volume) 312 | SecretName: default-token-72d89 313 | Events: 314 | FirstSeen LastSeen Count From SubobjectPath Reason Message 315 | ───────── ──────── ───── ──── ───────────── ────── ─────── 316 | 41s 41s 1 {scheduler } Scheduled Successfully assigned gluster1-1-k1dv6 to atomic-node2 317 | 41s 41s 1 {kubelet atomic-node2} implicitly required container POD Pulled Container image "openshift3/ose-pod:v3.1.1.6" already present on machine 318 | 41s 41s 1 {kubelet atomic-node2} implicitly required container POD Created Created with docker id ca1ff8adf07c 319 | 41s 41s 1 {kubelet atomic-node2} implicitly required container POD Started Started with docker id ca1ff8adf07c 320 | 40s 40s 1 {kubelet atomic-node2} spec.containers{glusterfs} Pulled Container image "gluster/gluster-centos" already present on machine 321 | 40s 40s 1 {kubelet atomic-node2} spec.containers{glusterfs} Created Created with docker id 12432af86090 322 | 40s 40s 1 {kubelet atomic-node2} spec.containers{glusterfs} Started Started with docker id 12432af86090 323 | 324 | 325 | [root@atomic-node2~]# oc get pods 326 | NAME READY STATUS RESTARTS AGE 327 | gluster1-1-k1dv6 1/1 Running 0 44s 328 | [root@atomic-node2~]# oc get pods 329 | NAME READY STATUS RESTARTS AGE 330 | gluster1-1-k1dv6 1/1 Running 0 46s 331 | [root@atomic-node2~]# oc get pods 332 | NAME READY STATUS RESTARTS AGE 333 | gluster1-1-k1dv6 1/1 Running 0 2m 334 | [root@atomic-node2~]# oc get pods 335 | NAME READY STATUS RESTARTS AGE 336 | gluster1-1-k1dv6 1/1 Running 0 2m 337 | [root@atomic-node2~]# oc edit pod gluster1-1-k1dv6 338 | Edit cancelled, no changes made. 339 | [root@atomic-node2~]# oc exec -ti gluster1-1-k1dv6 /bin/bash 340 | [root@gluster1-1-k1dv6 /]# 341 | [root@gluster1-1-k1dv6 /]# 342 | [root@gluster1-1-k1dv6 /]# 343 | [root@gluster1-1-k1dv6 /]# systemctl status glusterd 344 | ● glusterd.service - GlusterFS, a clustered file-system server 345 | Loaded: loaded (/usr/lib/systemd/system/glusterd.service; enabled; vendor preset: disabled) 346 | Active: active (running) since Thu 2016-05-19 04:02:45 EDT; 3min 16s ago 347 | Process: 216 ExecStart=/usr/sbin/glusterd -p /var/run/glusterd.pid --log-level $LOG_LEVEL $GLUSTERD_OPTIONS (code=exited, status=0/SUCCESS) 348 | Main PID: 219 (glusterd) 349 | CGroup: /system.slice/docker-12432af860908e9eab3b1d64d8abb4654bf5d23baa787389a3aecbf30308b63a.scope/system.slice/glusterd.service 350 | └─219 /usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO... 351 | 352 | May 19 04:02:40 gluster1-1-k1dv6 systemd[1]: Starting GlusterFS, a clustered.... 353 | May 19 04:02:45 gluster1-1-k1dv6 systemd[1]: Started GlusterFS, a clustered .... 354 | Hint: Some lines were ellipsized, use -l to show in full. 355 | [root@gluster1-1-k1dv6 /]# gluster v info 356 | No volumes present 357 | [root@gluster1-1-k1dv6 /]# service sshd status 358 | Redirecting to /bin/systemctl status sshd.service 359 | ● sshd.service - OpenSSH server daemon 360 | Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) 361 | Active: active (running) since Thu 2016-05-19 04:02:40 EDT; 3min 38s ago 362 | Docs: man:sshd(8) 363 | man:sshd_config(5) 364 | Main PID: 217 (sshd) 365 | CGroup: /system.slice/docker-12432af860908e9eab3b1d64d8abb4654bf5d23baa787389a3aecbf30308b63a.scope/system.slice/sshd.service 366 | └─217 /usr/sbin/sshd -D 367 | 368 | May 19 04:02:40 gluster1-1-k1dv6 systemd[1]: Started OpenSSH server daemon. 369 | May 19 04:02:40 gluster1-1-k1dv6 systemd[1]: Starting OpenSSH server daemon... 370 | May 19 04:02:40 gluster1-1-k1dv6 sshd[217]: Server listening on 0.0.0.0 port 22. 371 | May 19 04:02:40 gluster1-1-k1dv6 sshd[217]: Server listening on :: port 22. 372 | Hint: Some lines were ellipsized, use -l to show in full. 373 | [root@gluster1-1-k1dv6 /]# cat /etc/redhat-release 374 | CentOS Linux release 7.2.1511 (Core) 375 | [root@gluster1-1-k1dv6 /]# exit 376 | exit 377 | [root@atomic-node2~]# 378 | ~~~ 379 | 380 | 381 | -------------------------------------------------------------------------------- /gluster-endpoint/gluster-endpoints.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Endpoints 3 | metadata: 4 | name: glusterfs-cluster 5 | subsets: 6 | - addresses: 7 | - ip: 170.22.43.77 8 | ports: 9 | - port: 1 10 | -------------------------------------------------------------------------------- /gluster-pod/gluster-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: gluster 5 | labels: 6 | name: gluster 7 | spec: 8 | hostNetwork: true 9 | containers: 10 | - name: gluster 11 | image: gluster/gluster-centos 12 | ports: 13 | - name: gluster 14 | containerPort: 24007 15 | volumeMounts: 16 | - name: brickpath 17 | mountPath: "/mnt/brick1" 18 | securityContext: 19 | capabilities: {} 20 | privileged: true 21 | volumes: 22 | - name: brickpath 23 | hostPath: 24 | path: "/mnt/brick1" 25 | -------------------------------------------------------------------------------- /gluster-pv/gluster-pv.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "v1" 2 | kind: "PersistentVolume" 3 | metadata: 4 | name: "gluster-default-volume" 5 | spec: 6 | capacity: 7 | storage: "8Gi" 8 | accessModes: 9 | - "ReadWriteMany" 10 | glusterfs: 11 | endpoints: "glusterfs-cluster" 12 | path: "gluster_vol" 13 | readOnly: false 14 | persistentVolumeReclaimPolicy: "Recycle" 15 | -------------------------------------------------------------------------------- /gluster-pvc/gluster-pvc.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "PersistentVolumeClaim", 4 | "metadata": { 5 | "name": "storage-claim1" 6 | }, 7 | "spec": { 8 | "accessModes": [ 9 | "ReadWriteMany" 10 | ], 11 | "resources": { 12 | "requests": { 13 | "storage": "10Gi" 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /gluster-pvc/gluster-pvc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "v1" 2 | kind: "PersistentVolumeClaim" 3 | metadata: 4 | name: "glusterfs-claim" 5 | spec: 6 | accessModes: 7 | - "ReadWriteMany" 8 | resources: 9 | requests: 10 | storage: "8Gi" 11 | -------------------------------------------------------------------------------- /gluster-service/gluster-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: glusterfs-cluster 5 | labels: 6 | app: gluster 7 | spec: 8 | ports: 9 | - port: 24007 10 | 11 | -------------------------------------------------------------------------------- /gluster-template/gluster-daemonset-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Template", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "gluster", 6 | "creationTimestamp": null 7 | }, 8 | "objects": [{ 9 | "apiVersion": "extensions/v1beta1", 10 | "kind": "DaemonSet", 11 | "metadata": { 12 | "creationTimestamp": null, 13 | "generation": 1, 14 | "labels": { 15 | "name": "gluster" 16 | }, 17 | "name": "gluster", 18 | "namespace": "default" 19 | }, 20 | "spec": { 21 | "selector": { 22 | "matchLabels": { 23 | "name": "gluster" 24 | } 25 | }, 26 | "template": { 27 | "metadata": { 28 | "creationTimestamp": null, 29 | "labels": { 30 | "name": "gluster" 31 | } 32 | }, 33 | "spec": { 34 | "containers": [{ 35 | "image": "gluster/gluster-centos", 36 | "imagePullPolicy": "Always", 37 | "livenessProbe": { 38 | "exec": { 39 | "command": [ 40 | "/bin/bash", 41 | "-c", 42 | "systemctl status glusterd.service" 43 | ] 44 | }, 45 | "failureThreshold": 3, 46 | "periodSeconds": 10, 47 | "successThreshold": 1, 48 | "timeoutSeconds": 1 49 | }, 50 | "name": "gluster", 51 | "readinessProbe": { 52 | "exec": { 53 | "command": [ 54 | "/bin/bash", 55 | "-c", 56 | "systemctl status glusterd.service" 57 | ] 58 | }, 59 | "failureThreshold": 3, 60 | "periodSeconds": 10, 61 | "successThreshold": 1, 62 | "timeoutSeconds": 1 63 | }, 64 | "resources": {}, 65 | "securityContext": { 66 | "privileged": true 67 | }, 68 | "terminationMessagePath": "/dev/termination-log", 69 | "volumeMounts": [{ 70 | "mountPath": "/mnt/brick1", 71 | "name": "gluster-brick" 72 | }, { 73 | "mountPath": "/etc/gluster", 74 | "name": "gluster-etc" 75 | }, { 76 | "mountPath": "/var/log/gluster", 77 | "name": "gluster-logs" 78 | }, { 79 | "mountPath": "/var/lib/glusterd", 80 | "name": "gluster-config" 81 | }, { 82 | "mountPath": "/dev", 83 | "name": "gluster-dev" 84 | }, { 85 | "mountPath": "/sys/fs/cgroup", 86 | "name": "gluster-cgroup" 87 | }] 88 | }], 89 | "dnsPolicy": "ClusterFirst", 90 | "hostNetwork": true, 91 | "nodeSelector": { 92 | "region": "${region}" 93 | }, 94 | "restartPolicy": "Always", 95 | "securityContext": {}, 96 | "terminationGracePeriodSeconds": 1, 97 | "volumes": [{ 98 | "hostPath": { 99 | "path": "/mnt/brick1" 100 | }, 101 | "name": "gluster-brick" 102 | }, { 103 | "hostPath": { 104 | "path": "/etc/gluster" 105 | }, 106 | "name": "gluster-etc" 107 | }, { 108 | "hostPath": { 109 | "path": "/var/log/gluster" 110 | }, 111 | "name": "gluster-logs" 112 | }, { 113 | "hostPath": { 114 | "path": "/var/lib/glusterd" 115 | }, 116 | "name": "gluster-config" 117 | }, { 118 | "hostPath": { 119 | "path": "/dev" 120 | }, 121 | "name": "gluster-dev" 122 | }, { 123 | "hostPath": { 124 | "path": "/sys/fs/cgroup" 125 | }, 126 | "name": "gluster-cgroup" 127 | }] 128 | } 129 | } 130 | } 131 | }], 132 | "parameters": [{ 133 | "name": "region", 134 | "displayName": "Region tag for GlusterFS nodes", 135 | "description": "Tag of storage node for label region which will run the container", 136 | "required": true, 137 | "value": "storage" 138 | }] 139 | } 140 | 141 | -------------------------------------------------------------------------------- /gluster-template/gluster-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "Template", 3 | "apiVersion": "v1", 4 | "metadata": { 5 | "name": "gluster", 6 | "annotations": { 7 | "description": "GlusterFS container deployment template", 8 | "tags": "gluster" 9 | } 10 | }, 11 | "labels": { 12 | "template": "gluster" 13 | }, 14 | "objects": [ 15 | { 16 | "kind": "DeploymentConfig", 17 | "apiVersion": "v1", 18 | "metadata": { 19 | "name": "${NAME}", 20 | "annotations": { 21 | "description": "Deploys the GlusterFS container" 22 | } 23 | }, 24 | "spec": { 25 | "replicas": 1, 26 | "selector": { 27 | "name": "${NAME}" 28 | }, 29 | "template": { 30 | "metadata": { 31 | "name": "${NAME}", 32 | "labels": { 33 | "name": "${NAME}" 34 | } 35 | }, 36 | "triggers": [ 37 | { 38 | "type": "ConfigChange" 39 | } 40 | ], 41 | "strategy": { 42 | "type": "Replace" 43 | }, 44 | "spec": { 45 | "nodeSelector": { 46 | "kubernetes.io/hostname": "${HOSTNAME}" 47 | }, 48 | "containers": [ 49 | { 50 | "image": "gluster/gluster-centos", 51 | "name": "gluster", 52 | "volumeMounts": [ 53 | 54 | { 55 | "name": "gluster-etc", 56 | "mountPath": "/etc/gluster" 57 | }, 58 | { 59 | "name": "gluster-logs", 60 | "mountPath": "/var/log/gluster" 61 | }, 62 | { 63 | "name": "gluster-config", 64 | "mountPath": "/var/lib/glusterd" 65 | }, 66 | { 67 | "name": "gluster-dev", 68 | "mountPath": "/dev" 69 | }, 70 | { 71 | "name": "gluster-cgroup", 72 | "mountPath": "/sys/fs/cgroup" 73 | } 74 | ], 75 | "securityContext": { 76 | "capabilities": {}, 77 | "privileged": true 78 | }, 79 | "readinessProbe": { 80 | "exec": { 81 | "command": [ 82 | "/bin/bash", 83 | "-c", 84 | "systemctl status glusterd.service" 85 | ] 86 | } 87 | }, 88 | "livenessProbe": { 89 | "exec": { 90 | "command": [ 91 | "/bin/bash", 92 | "-c", 93 | "systemctl status glusterd.service" 94 | ] 95 | } 96 | } 97 | } 98 | ], 99 | "volumes": [ 100 | 101 | { 102 | "name": "gluster-etc", 103 | "hostPath": { 104 | "path": "/etc/gluster" 105 | } 106 | }, 107 | { 108 | "name": "gluster-logs", 109 | "hostPath": { 110 | "path": "/var/log/gluster" 111 | } 112 | }, 113 | { 114 | "name": "gluster-config", 115 | "hostPath": { 116 | "path": "/var/lib/glusterd" 117 | } 118 | }, 119 | { 120 | "name": "gluster-dev", 121 | "hostPath": { 122 | "path": "/dev" 123 | } 124 | }, 125 | { 126 | "name": "gluster-cgroup", 127 | "hostPath": { 128 | "path": "/sys/fs/cgroup" 129 | } 130 | } 131 | ] 132 | } 133 | } 134 | } 135 | } 136 | ], 137 | "parameters": [ 138 | { 139 | "name": "NAME", 140 | "displayName": "Name", 141 | "description": "The name assigned to all of the frontend objects defined in this template.", 142 | "required": true, 143 | "value": "gluster" 144 | }, 145 | { 146 | "name": "HOSTNAME", 147 | "displayName": "Hostname", 148 | "description": "The hostname where the template has to run", 149 | "required": true, 150 | "value": "node-1" 151 | } 152 | ] 153 | } 154 | -------------------------------------------------------------------------------- /gluster-template/gluster-template.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | items: 3 | - apiVersion: v1 4 | kind: DeploymentConfig 5 | metadata: 6 | annotations: 7 | description: Deploys the GlusterFS container 8 | labels: 9 | template: gluster 10 | name: gluster 11 | spec: 12 | replicas: 1 13 | selector: 14 | name: gluster 15 | template: 16 | metadata: 17 | labels: 18 | name: gluster 19 | name: gluster 20 | spec: 21 | containers: 22 | - image: gluster/gluster-centos 23 | livenessProbe: 24 | exec: 25 | command: 26 | - /bin/bash 27 | - -c 28 | - systemctl status glusterd.service 29 | name: gluster 30 | readinessProbe: 31 | exec: 32 | command: 33 | - /bin/bash 34 | - -c 35 | - systemctl status glusterd.service 36 | securityContext: 37 | capabilities: {} 38 | privileged: true 39 | volumeMounts: 40 | - mountPath: /etc/gluster 41 | name: gluster-etc 42 | - mountPath: /var/log/gluster 43 | name: gluster-logs 44 | - mountPath: /var/lib/glusterd 45 | name: gluster-config 46 | - mountPath: /dev 47 | name: gluster-dev 48 | - mountPath: /sys/fs/cgroup 49 | name: gluster-cgroup 50 | nodeSelector: 51 | kubernetes.io/hostname: node-1 52 | volumes: 53 | - hostPath: 54 | path: /etc/gluster 55 | name: gluster-etc 56 | - hostPath: 57 | path: /var/log/gluster 58 | name: gluster-logs 59 | - hostPath: 60 | path: /var/lib/glusterd 61 | name: gluster-config 62 | - hostPath: 63 | path: /dev 64 | name: gluster-dev 65 | - hostPath: 66 | path: /sys/fs/cgroup 67 | name: gluster-cgroup 68 | strategy: 69 | type: Replace 70 | triggers: 71 | - type: ConfigChange 72 | kind: List 73 | metadata: {} 74 | --------------------------------------------------------------------------------