-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from nds-org/develop
Release v1.1
- Loading branch information
Showing
15 changed files
with
435 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
#!/bin/bash | ||
echo '============================' | ||
echo '= Installing kubeadm =' | ||
echo '============================' | ||
cd ~ | ||
git clone https://github.com/data-8/kubeadm-bootstrap | ||
git clone https://github.com/nds-org/kubeadm-bootstrap -b v1.1 | ||
cd kubeadm-bootstrap | ||
sudo ./install-kubeadm.bash | ||
|
||
sudo apt-get install -y jq nfs-common | ||
|
||
echo '============================' | ||
echo '= Updating OS Dependencies =' | ||
echo '============================' | ||
sudo apt-get update -qq | ||
sudo apt-get upgrade -qq | ||
sudo apt-get install -qq jq nfs-common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/bash | ||
# | ||
# Usage: ./deploy-glfs.sh <number_of_storage_nodes> | ||
# | ||
|
||
# DEBUG ONLY: Set this to "echo" to neuter the script and perform a dry-run | ||
DEBUG="" | ||
|
||
# The host directory to store brick files | ||
BRICK_HOSTDIR="/tmp" | ||
|
||
# Read in the desired number of storage nodes from first arg | ||
NODE_COUNT="$1" | ||
|
||
# Ensure that we have enough storage nodes to run GLFS | ||
if [ "$NODE_COUNT" -lt 2 ]; then | ||
echo "ERROR: Cannot deploy GlusterFS with less than 2 nodes" | ||
exit 1 | ||
fi | ||
|
||
# Label storage nodes appropriately | ||
STORAGE_NODES=$(kubectl get nodes --no-headers | grep storage | awk '{print $1}') | ||
for node in $STORAGE_NODES; do | ||
$DEBUG kubectl label nodes $node storagenode=glusterfs | ||
done | ||
|
||
# Create the GLFS cluster | ||
$DEBUG kubectl apply -f glfs/glusterfs-daemonset.yaml | ||
|
||
# Wait for the GLFS cluster to come up | ||
count="$(kubectl get pods --no-headers | grep glusterfs | grep -v provisioner | awk '{print $3}' | grep Running | wc -l)" | ||
while [ "$count" -lt "$NODE_COUNT" ]; do | ||
echo "Waiting for GLFS: $count / $NODE_COUNT" | ||
sleep 5 | ||
count="$(kubectl get pods --no-headers | grep glusterfs | grep -v provisioner | awk '{print $3}' | grep -o Running | wc -l)" | ||
done | ||
echo "GlusterFS is now Running: $count / $NODE_COUNT" | ||
|
||
# Retrieve GlusterFS pod IPs | ||
PEER_IPS=$(kubectl get pods -o wide | grep glusterfs | grep -v provisioner | awk '{print $6}') | ||
|
||
# Use pod names / IPs to exec in and perform `gluster peer probe` | ||
for pod_ip in ${PEER_IPS}; do | ||
for peer_ip in ${PEER_IPS}; do | ||
# Skip each node probing itself | ||
if [ "$pod_ip" == "$peer_ip" ]; then | ||
continue; | ||
fi | ||
|
||
# Perform a gluster peer probe | ||
pod_name=$(kubectl get pods -o wide | grep $pod_ip | awk '{print $1}') | ||
$DEBUG kubectl exec -it $pod_name gluster peer probe $peer_ip | ||
done; | ||
done; | ||
|
||
# Dynamically build StorageClass from pod IPs (see below) | ||
BRICK_PATHS="" | ||
for pod_ip in ${PEER_IPS[@]}; do | ||
# Insert comma if we already started accumlating ips/paths | ||
if [ "$BRICK_PATHS" != "" ]; then | ||
BRICK_PATHS="$BRICK_PATHS," | ||
fi | ||
|
||
# Build up brickrootPaths one host at a time | ||
BRICK_PATHS="${BRICK_PATHS}${pod_ip}:${BRICK_HOSTDIR}" | ||
done | ||
|
||
# Modify StorageClass to contain our GlusterFS brickrootPaths | ||
echo "--- | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1 | ||
metadata: | ||
name: glusterfs-simple | ||
provisioner: gluster.org/glusterfs-simple | ||
parameters: | ||
forceCreate: \"true\" | ||
volumeType: \"replica 2\" | ||
brickrootPaths: \"$BRICK_PATHS\" | ||
" > glfs/storageclass.yaml | ||
|
||
# Create the storage class | ||
$DEBUG kubectl apply -f glfs/storageclass.yaml | ||
|
||
# Bind the necessary ServiceAccount / ClusterRole | ||
$DEBUG kubectl apply -f glfs/rbac.yaml | ||
|
||
# Create the GLFS Simple Provisioner | ||
$DEBUG kubectl apply -f glfs/deployment.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
#!/bin/bash | ||
|
||
echo '=============================' | ||
echo '= Deploying NFS Provisioner =' | ||
echo '=============================' | ||
|
||
# Create the NFS storage class | ||
kubectl create -f nfs/storageclass.yaml | ||
kubectl apply -f nfs/storageclass.yaml | ||
|
||
# Deploy RBAC role/binding | ||
kubectl create -f nfs/rbac.yaml | ||
kubectl apply -f nfs/rbac.yaml | ||
|
||
# Create the NFS provisioner | ||
kubectl create -f nfs/deployment.yaml | ||
kubectl apply -f nfs/deployment.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: glusterfs-simple-provisioner | ||
namespace: kube-system | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: glusterfs-simple-provisioner | ||
spec: | ||
serviceAccount: glfs-provisioner | ||
containers: | ||
- image: "quay.io/external_storage/glusterfs-simple-provisioner:latest" | ||
name: glusterfs-simple-provisioner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
kind: DaemonSet | ||
apiVersion: extensions/v1beta1 | ||
metadata: | ||
name: glusterfs | ||
labels: | ||
glusterfs: daemonset | ||
annotations: | ||
description: GlusterFS DaemonSet | ||
tags: glusterfs | ||
spec: | ||
template: | ||
metadata: | ||
name: glusterfs | ||
labels: | ||
glusterfs-node: pod | ||
spec: | ||
nodeSelector: | ||
storagenode: glusterfs | ||
hostNetwork: true | ||
containers: | ||
- image: gluster/gluster-centos:latest | ||
imagePullPolicy: IfNotPresent | ||
name: glusterfs | ||
volumeMounts: | ||
- name: glusterfs-heketi | ||
mountPath: "/var/lib/heketi" | ||
- name: glusterfs-run | ||
mountPath: "/run" | ||
- name: glusterfs-lvm | ||
mountPath: "/run/lvm" | ||
- name: glusterfs-etc | ||
mountPath: "/etc/glusterfs" | ||
- name: glusterfs-logs | ||
mountPath: "/var/log/glusterfs" | ||
- name: glusterfs-config | ||
mountPath: "/var/lib/glusterd" | ||
- name: glusterfs-dev | ||
mountPath: "/dev" | ||
- name: glusterfs-misc | ||
mountPath: "/var/lib/misc/glusterfsd" | ||
- name: glusterfs-cgroup | ||
mountPath: "/sys/fs/cgroup" | ||
readOnly: true | ||
- name: glusterfs-ssl | ||
mountPath: "/etc/ssl" | ||
readOnly: true | ||
securityContext: | ||
capabilities: {} | ||
privileged: true | ||
readinessProbe: | ||
timeoutSeconds: 3 | ||
initialDelaySeconds: 40 | ||
exec: | ||
command: | ||
- "/bin/bash" | ||
- "-c" | ||
- systemctl status glusterd.service | ||
periodSeconds: 25 | ||
successThreshold: 1 | ||
failureThreshold: 15 | ||
livenessProbe: | ||
timeoutSeconds: 3 | ||
initialDelaySeconds: 40 | ||
exec: | ||
command: | ||
- "/bin/bash" | ||
- "-c" | ||
- systemctl status glusterd.service | ||
periodSeconds: 25 | ||
successThreshold: 1 | ||
failureThreshold: 15 | ||
volumes: | ||
- name: glusterfs-heketi | ||
hostPath: | ||
path: "/var/lib/heketi" | ||
- name: glusterfs-run | ||
- name: glusterfs-lvm | ||
hostPath: | ||
path: "/run/lvm" | ||
- name: glusterfs-etc | ||
hostPath: | ||
path: "/etc/glusterfs" | ||
- name: glusterfs-logs | ||
hostPath: | ||
path: "/var/log/glusterfs" | ||
- name: glusterfs-config | ||
hostPath: | ||
path: "/var/lib/glusterd" | ||
- name: glusterfs-dev | ||
hostPath: | ||
path: "/dev" | ||
- name: glusterfs-misc | ||
hostPath: | ||
path: "/var/lib/misc/glusterfsd" | ||
- name: glusterfs-cgroup | ||
hostPath: | ||
path: "/sys/fs/cgroup" | ||
- name: glusterfs-ssl | ||
hostPath: | ||
path: "/etc/ssl" |
Oops, something went wrong.