#!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #. What this is: script to setup a Ceph-based SDS (Software Defined Storage) #. service for a kubernetes cluster, using Helm as deployment tool. #. Prerequisites: #. - Ubuntu xenial server for master and agent nodes #. - key-based auth setup for ssh/scp between master and agent nodes #. - 192.168.0.0/16 should not be used on your server network interface subnets #. Usage: # Intended to be called from k8s-cluster.sh in this folder. To run directly: #. $ bash ceph-helm.sh "" [ceph_dev] #. nodes: space-separated list of ceph node IPs #. cluster-net: CIDR of ceph cluster network e.g. 10.0.0.1/24 #. public-net: CIDR of public network #. ceph_dev: disk to use for ceph. ***MUST NOT BE USED FOR ANY OTHER PURPOSE*** #. if not provided, ceph data will be stored on osd nodes in /ceph #. #. Status: work in progress, incomplete # function log() { f=$(caller 0 | awk '{print $2}') l=$(caller 0 | awk '{print $1}') echo "$f:$l ($(date)) $1" } function setup_ceph() { nodes=$1 private_net=$2 public_net=$3 dev=$4 log "Install ceph prerequisites" sudo apt-get -y install ceph ceph-common # per https://github.com/att/netarbiter/tree/master/sds/ceph-docker/examples/helm log "Clone netarbiter" git clone https://github.com/att/netarbiter.git cd netarbiter/sds/ceph-docker/examples/helm log "Prepare a ceph namespace in your K8s cluster" ./prep-ceph-ns.sh log "Run ceph-mon, ceph-mgr, ceph-mon-check, and rbd-provisioner" # Pre-req per https://github.com/att/netarbiter/tree/master/sds/ceph-docker/examples/helm#notes kubedns=$(kubectl get service -o json --namespace kube-system kube-dns | \ jq -r '.spec.clusterIP') cat <