diff options
Diffstat (limited to 'tools/kubernetes/demo_deploy.sh')
-rw-r--r-- | tools/kubernetes/demo_deploy.sh | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/tools/kubernetes/demo_deploy.sh b/tools/kubernetes/demo_deploy.sh index 7138224..6ac03b5 100644 --- a/tools/kubernetes/demo_deploy.sh +++ b/tools/kubernetes/demo_deploy.sh @@ -20,29 +20,29 @@ #. - prometheus + grafana for cluster monitoring/stats #. - cloudify + kubernetes plugin and a demo hello world (nginx) app installed #. will be setup with: -#. Prometheus dashboard: http://<admin_public_ip>:9090 -#. Grafana dashboard: http://<admin_public_ip>:3000 +#. Prometheus dashboard: http://<master_public_ip>:9090 +#. Grafana dashboard: http://<master_public_ip>:3000 #. #. Prerequisites: -#. - Ubuntu server for kubernetes cluster nodes (admin/master and agent nodes) -#. - MAAS server as cluster admin for kubernetes master/agent nodes +#. - 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 <key> "<hosts>" <admin ip> -#. "<agent ips>" <pub-net> <priv-net> [<extras>] +#. $ bash ~/models/tools/kubernetes/demo_deploy.sh <key> "<hosts>" <master> +#. "<workers>" <pub-net> <priv-net> [<extras>] #. <key>: name of private key for cluster node ssh (in current folder) #. <hosts>: space separated list of hostnames managed by MAAS -#. <admin ip>: IP of cluster admin node -#. <agent_ips>: space separated list of agent node IPs +#. <master>: IP of cluster master node +#. <workers>: space separated list of agent node IPs #. <pub-net>: CID formatted public network #. <priv-net>: CIDR formatted private network (may be same as pub-net) #. <extras>: optional name of script for extra setup functions as needed key=$1 nodes="$2" -admin_ip=$3 -agent_ips="$4" +master=$3 +workers="$4" priv_net=$5 pub_net=$6 extras=$7 @@ -51,36 +51,45 @@ source ~/models/tools/maas/deploy.sh $1 "$2" $5 eval `ssh-agent` ssh-add $key if [[ "x$extras" != "x" ]]; then source $extras; fi -scp -o StrictHostKeyChecking=no $key ubuntu@$admin_ip:/home/ubuntu/$key +scp -o StrictHostKeyChecking=no $key ubuntu@$master:/home/ubuntu/$key echo "Setting up kubernetes..." scp -o StrictHostKeyChecking=no ~/models/tools/kubernetes/k8s-cluster.sh \ - ubuntu@$admin_ip:/home/ubuntu/. -ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip <<EOF + ubuntu@$master:/home/ubuntu/. +ssh -x -o StrictHostKeyChecking=no ubuntu@$master <<EOF exec ssh-agent bash ssh-add $key -bash k8s-cluster.sh all "$agent_ips" $priv_net $pub_net +bash k8s-cluster.sh all "$workers" $priv_net $pub_net EOF # TODO: Figure this out... Have to break the setup into two steps as something # causes the ssh session to end before the prometheus setup, if both scripts # are in the same ssh session echo "Setting up Prometheus..." -ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip mkdir -p \ +ssh -x -o StrictHostKeyChecking=no ubuntu@$master mkdir -p \ /home/ubuntu/models/tools/prometheus scp -r -o StrictHostKeyChecking=no ~/models/tools/prometheus/* \ - ubuntu@$admin_ip:/home/ubuntu/models/tools/prometheus -ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip <<EOF + ubuntu@$master:/home/ubuntu/models/tools/prometheus +ssh -x -o StrictHostKeyChecking=no ubuntu@$master <<EOF exec ssh-agent bash ssh-add $key cd models/tools/prometheus -bash prometheus-tools.sh all "$agent_ips" +bash prometheus-tools.sh all "$workers" EOF echo "Setting up cloudify..." scp -r -o StrictHostKeyChecking=no ~/models/tools/cloudify \ - ubuntu@$admin_ip:/home/ubuntu/. -ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip \ + ubuntu@$master:/home/ubuntu/. +ssh -x -o StrictHostKeyChecking=no ubuntu@$master \ bash cloudify/k8s-cloudify.sh prereqs -ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip \ +ssh -x -o StrictHostKeyChecking=no ubuntu@$master \ bash cloudify/k8s-cloudify.sh setup -ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip \ +ssh -x -o StrictHostKeyChecking=no ubuntu@$master \ bash cloudify/k8s-cloudify.sh demo + echo "All done!" +export NODE_PORT=$(ssh -x -o StrictHostKeyChecking=no ubuntu@$master kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services dw-dokuwiki) +export NODE_IP=$(ssh -x -o StrictHostKeyChecking=no ubuntu@$master kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}") +echo "Helm chart demo app dokuwiki is available at http://$NODE_IP:$NODE_PORT/" +# TODO update Cloudify demo app to have public exposed service address +echo "Cloudify-deployed demo app nginx is available at TBD" +echo "Prometheus UI is available at http://$master:9090" +echo "Grafana dashboards are available at http://$master:3000 (login as admin/admin)" +echo "Grafana API is available at http://admin:admin@$master:3000/api/v1/query?query=<string>" |