Code Monkey home page Code Monkey logo

glusterfs-azure's Introduction

GlusterFS

GlusterFS is an open source scale-out filesystem. This solution references installation guide for Centos and installation guide for RHEL to provision a GlusterFS server cluster on Azure. It also provides examples to how to mount GlusterFS volumes locally and how to use GlusterFS volumes from Kubernetes containers.

Usage

Deploy the Gluster cluster on Azure using the Deploy button ☝️ or using the Azure CLI.

From Azure CLI, populate azuredeploy.parameters.json with the following parameters before starting the deployment.

az group deployment create --resource-group <RESOURCEGROUP> --template-file azuredeploy.json --parameters azuredeploy.parameters.json

Below is the list of template parameters:

Name Required Description Default
adminUsername ✔️ SSH user name
adminPassword ✔️ SSH user password
hostOs ✔️ OS to install on the host system. Allowed values: Centos, Ubuntu, and RHEL Centos
nodeNumber ✔️ Number of nodes in the gluster file system. Allowed values: 2, 4, 6, and 8 2
diskNumber ✔️ Number of disks per node. Allowed values: 2, 3 and 4 2
rhsmUsername [RHEL only] Name of the virtual network to be used
rhsmPassword [RHEL only] Name of the virtual network to be used
rhsmPoolId [RHEL only] Name of the virtual network to be used
virtualNetworkName ✔️ Name of the virtual network to be used
virtualNetworkNewOrExisting ✔️ Create a new or use existing Virtual Network. Allowed values: new and existing new
vmNamePrefix ✔️ VM name prefix, a number will be appended for each node
volumeName ✔️ Gluster file system volume name gfsvol

How it works

Verify Gluster Volumes

To verify the new gluster volume is created and running, run the following on one of the gluster nodes:

# gluster volume info
 
Volume Name: gfsvol
Type: Replicate
Volume ID: 2bff68ee-xxxx-xxxx-xxxx-bbd6b3fcfa51
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: <NODE1>:/datadrive/brick
Brick2: <NODE2>:/datadrive/brick
Options Reconfigured:
transport.address-family: inet
nfs.disable: on

Mount Gluster Volumes

To mount the new gluster volume to a new host, install the GlusterFS native client from here.

Use the private ip or node name of one of the gluster hosts to mount to a local mount directory

# mount -t glusterfs HOSTNAME-OR-IPADDRESS:/VOLNAME MOUNTDIR

# mount -t glusterfs 10.0.0.10:/gfsvol /mnttest/

Verify Mounted Volume

To verify the size of the new gluster volume, run df -h you should see the local mount directory with the same size as the total size of all the managed disks you have created.

# df -h
...
10.0.0.10:/gfsvol  2.0T   81M  1.9T   1% /mnttest
..

Mount Gluster Volumes from Kubernetes Pod

If you want access gluster volumes from Kubernetes pods, one way is to provision the gluster cluster in the same vnet as your Kubernetes cluster.

Create Gluster Cluster using existing vnet

Assuming you already have a K8s cluster running, update the azuredeploy.parameters.json file to provision a gluster cluster in the same vnet and same resource group as your k8s cluster.

	"virtualNetworkName": {
	  "value": "k8s-vnet-xxxxxxxx"
	},
	"virtualNetworkNewOrExisting": {
	  "value": "existing"
	},

From Azure CLI,

az group deployment create --resource-group <KUBERNETES-CLUSTER-RESOURCEGROUP> --template-file azuredeploy.json --parameters azuredeploy.parameters.json

Now that you have a gluster cluster and a kubernetes cluster running in the same vnet, use this documentation to allow containers to use GlusterFS volumes.

$ kubectl create -f _output/glusterfs-endpoints.json 
endpoints "glusterfs-cluster" created
$ kubectl create -f _output/glusterfs-service.json 
service "glusterfs-cluster" created
$ kubectl create -f _output/glusterfs-pod.json

Once the pod is running, let's verify the gluster volume has been mounted:

$ kubectl exec -it glusterfs -- /bin/bash
root@glusterfs:/# df -h         
...
10.0.0.10:gfsvol  2.0T   81M  1.9T   1% /mnt/gluster

glusterfs-azure's People

Contributors

haroldwongms avatar ritazh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

glusterfs-azure's Issues

Volume not created after the deployment

Just want to log this for future ref.

Just deployed with default params in an existing k8s vnet.

The deployment worked on the Azure side, but there is no volume created inside my glusterfs cluster.

Stderr from the extension on vm0 :

ls: cannot access /datadrive: No such file or directory
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md127 started.
deploygluster.sh: line 94: [: -ne: unary operator expected
mke2fs 1.42.9 (28-Dec-2013)
Error: No matching Packages to list
--2018-02-22 22:45:21--  https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.24, 209.132.181.23, 209.132.181.25
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.24|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15080 (15K) [application/x-rpm]
Saving to: ‘epel-release-latest-7.noarch.rpm’

     0K .......... ....                                       100%  216K=0.07s

2018-02-22 22:45:21 (216 KB/s) - ‘epel-release-latest-7.noarch.rpm’ saved [15080/15080]

warning: ./epel-release-latest-7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Warning: RPMDB altered outside of yum.
warning: /var/cache/yum/x86_64/7/centos-gluster312/packages/glusterfs-api-3.12.6-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e451e5b5: NOKEY
Importing GPG key 0xE451E5B5:
 Userid     : "CentOS Storage SIG (http://wiki.centos.org/SpecialInterestGroup/Storage) <[email protected]>"
 Fingerprint: 7412 9c0b 173b 071a 3775 951a d4a2 e50b e451 e5b5
 Package    : centos-release-storage-common-1-2.el7.centos.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Storage
Created symlink from /etc/systemd/system/multi-user.target.wants/glusterd.service to /usr/lib/systemd/system/glusterd.service.
ls: cannot access /datadrive/brick: No such file or directory

I created my volume manually for now, I will try to investigate it more later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.