From f5da516479d58af541cb78f6f083a4381951ef6c Mon Sep 17 00:00:00 2001 From: Michael O'Brien Date: Mon, 4 Feb 2019 23:51:11 -0500 Subject: adjust rancher kubernetes install for rhel76 Change-Id: Iea017fcd194b2c56cbdfc0af380482e913d5b7eb Issue-ID: LOG-960 Signed-off-by: Michael O'Brien --- deploy/rancher/oom_rancher_setup.sh | 85 +++++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/deploy/rancher/oom_rancher_setup.sh b/deploy/rancher/oom_rancher_setup.sh index b9366fb..0ee8234 100755 --- a/deploy/rancher/oom_rancher_setup.sh +++ b/deploy/rancher/oom_rancher_setup.sh @@ -1,7 +1,7 @@ #!/bin/bash ############################################################################# # -# Copyright © 2018 Amdocs. +# Copyright © 2019 Amdocs. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ # # This installation is for a rancher managed install of kubernetes # after this run the standard oom install -# this installation can be run on amy ubuntu 16.04 VM or physical host +# this installation can be run on amy ubuntu 16.04 VM, RHEL 7.6 (root only), physical or cloud azure/aws host # https://wiki.onap.org/display/DW/Cloud+Native+Deployment # source from https://jira.onap.org/browse/LOG-320 # Michael O'Brien @@ -29,30 +29,29 @@ # casablanca (until RC1) # Rancher 1.6.18, Kubernetes 1.10.3, Kubectl 1.10.3, Helm 2.9.2, Docker 17.03 # casablanca - integration change alignment for INT-586 - 29th Oct via LOG-806 -# Rancher 1.6.22, Kubernetes 1.11.2, kubectl 1.11.2, Helm 2.9.2, Docker 17.03 +# Rancher 1.6.22, Kubernetes 1.11.5, kubectl 1.11.5, Helm 2.9.1, Docker 17.03 # master/dublin - LOG-895 -# Rancher 1.6.25, Kubernetes 1.11.3, kubectl 1.11.3, Helm 2.9.2, Docker 17.03 +# Rancher 1.6.25, Kubernetes 1.11.5, kubectl 1.11.5, Helm 2.9.1, Docker 17.03 usage() { cat <> /etc/hosts echo "If you must install as non-root - comment out the docker install below - run it separately, run the user mod, logout/login and continue this script" curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh sudo usermod -aG docker $USERNAME - echo "install make - required for beijing+" + echo "install make - required for beijing+ - installed via yum groupinstall Development Tools in RHEL" + # ubuntu specific sudo apt-get install make -y sudo docker run -d --restart=unless-stopped -p $PORT:8080 --name rancher_server rancher/server:v$RANCHER_VERSION @@ -106,9 +110,13 @@ install_onap() { sudo cp rancher-v${RANCHER_CLI_VER}/rancher . sudo chmod +x ./rancher - echo "install jq" - apt install jq -y + echo "install jq for json parsing" + sudo wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -O jq + sudo chmod 777 jq + # not +x or jq will not be runnable from your non-root user + sudo mv jq /usr/local/bin echo "wait for rancher server container to finish - 3 min" + echo "if you are planning on running a co-located host to bring up more than 110 pods on a single vm - you have 3 min to add --max-pods=900 in additional kublet flags - in the k8s template" sleep 60 echo "2 more min" sleep 60 @@ -127,7 +135,7 @@ install_onap() { export RANCHER_ACCESS_KEY=$KEY_PUBLIC export RANCHER_SECRET_KEY=$KEY_SECRET ./rancher env ls - echo "wait 60 sec for rancher environments can settle before we create the onap kubernetes one" + echo "wait 60 sec for rancher environments to settle before we create the onap kubernetes one" sleep 60 echo "Creating kubernetes environment named ${KUBE_ENV_NAME}" @@ -178,8 +186,7 @@ install_onap() { sleep 420 echo "1 more min" sleep 60 - #read -p "wait for host registration to complete before generating the client token....." - + # base64 encode the kubectl token from the auth pair # generate this after the host is registered KUBECTL_TOKEN=$(echo -n 'Basic '$(echo -n "$RANCHER_ACCESS_KEY:$RANCHER_SECRET_KEY" | base64 -w 0) | base64 -w 0) @@ -207,27 +214,47 @@ users: EOF - echo "run the following if you installed a higher kubectl version than the server" - echo "helm init --upgrade" + echo "Verify all pods up on the kubernetes system - will return localhost:8080 until a host is added" echo "kubectl get pods --all-namespaces" kubectl get pods --all-namespaces echo "upgrade server side of helm in kubernetes" - sudo helm version + if [ "$USERNAME" == "root" ]; then + helm version + else + sudo helm version + fi echo "sleep 90" sleep 90 - sudo helm init --upgrade + if [ "$USERNAME" == "root" ]; then + helm init --upgrade + else + sudo helm init --upgrade + fi echo "sleep 90" sleep 90 echo "verify both versions are the same below" - sudo helm version + if [ "$USERNAME" == "root" ]; then + helm version + else + sudo helm version + fi echo "start helm server" - sudo helm serve & + if [ "$USERNAME" == "root" ]; then + helm serve & + else + sudo helm serve & + fi echo "sleep 30" sleep 30 echo "add local helm repo" - sudo helm repo add local http://127.0.0.1:8879 - sudo helm repo list + if [ "$USERNAME" == "root" ]; then + helm repo add local http://127.0.0.1:8879 + helm repo list + else + sudo helm repo add local http://127.0.0.1:8879 + sudo helm repo list + fi echo "To enable grafana dashboard - do this after running cd.sh which brings up onap - or you may get a 302xx port conflict" echo "kubectl expose -n kube-system deployment monitoring-grafana --type=LoadBalancer --name monitoring-grafana-client" echo "to get the nodeport for a specific VM running grafana" @@ -242,8 +269,9 @@ ENVIRON= COMPUTEADDRESS=true ADDRESS= VALIDATE=false +USERNAME=ubuntu -while getopts ":b:s:e:u:c:a:v" PARAM; do +while getopts ":b:s:e:u:c:a:l:v" PARAM; do case $PARAM in u) usage @@ -264,6 +292,9 @@ while getopts ":b:s:e:u:c:a:v" PARAM; do a) ADDRESS=${OPTARG} ;; + l) + USERNAME=${OPTARG} + ;; v) VALIDATE=${OPTARG} ;; @@ -279,5 +310,5 @@ if [[ -z $BRANCH ]]; then exit 1 fi -install_onap $BRANCH $SERVER $ENVIRON $COMPUTEADDRESS $ADDRESS $VALIDATE +install_onap $BRANCH $SERVER $ENVIRON $COMPUTEADDRESS $ADDRESS $USERNAME $VALIDATE -- cgit 1.2.3-korg