#!/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: Complete scripted deployment of an experimental kubernetes-based #. cloud-native application platform. When complete, kubernetes and the following #. will be installed: #. - helm and dokuwiki as a demo helm cart based application #. - prometheus + grafana for cluster monitoring/stats #. - cloudify + kubernetes plugin and a demo hello world (nginx) app installed #. will be setup with: #. Prometheus dashboard: http://:9090 #. Grafana dashboard: http://:3000 #. #. Prerequisites: #. - Ubuntu server for kubernetes cluster nodes (master and worker nodes) #. - MAAS server as cluster admin for kubernetes master/worker nodes #. - Password-less ssh key provided for node setup #. Usage: on the MAAS server #. $ git clone https://gerrit.opnfv.org/gerrit/models ~/models #. $ bash ~/models/tools/kubernetes/demo_deploy.sh "" #. "" [] #. : name of private key for cluster node ssh (in current folder) #. : space separated list of hostnames managed by MAAS #. : IP of cluster master node #. : space separated list of agent node IPs #. : CID formatted public network #. : CIDR formatted private network (may be same as pub-net) #. : "helm" or "baremetal" #. : disk (e.g. sda, sdb) or folder (e.g. "/ceph") #. : optional name of script for extra setup functions as needed key=$1 nodes="$2" master=$3 workers="$4" priv_net=$5 pub_net=$6 ceph_mode=$7 ceph_dev=$8 extras=$9 source ~/models/tools/maas/deploy.sh $1 "$2" $9 eval `ssh-agent` ssh-add $key if [[ "x$extras" != "x" ]]; then source $extras; fi scp -o StrictHostKeyChecking=no $key ubuntu@$master:/home/ubuntu/$key echo "$0 $(date): Setting up kubernetes..." scp -r -o StrictHostKeyChecking=no ~/models/tools/kubernetes/* \ ubuntu@$master:/home/ubuntu/. ssh -x -o StrictHostKeyChecking=no ubuntu@$master <"