From 0017f39d399bc985b4ba21f64f23313ace76798f Mon Sep 17 00:00:00 2001 From: Sachin Agarwal Date: Mon, 1 May 2023 14:12:22 -0400 Subject: [PATCH] Adding more logging --- .../install-application-stack.sh | 30 ++++++++++++++----- .../install-microk8s-on-ubuntu.sh | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/code/local-kubernetes-cluster-installation/install-application-stack.sh b/code/local-kubernetes-cluster-installation/install-application-stack.sh index afb0527..a4cc518 100755 --- a/code/local-kubernetes-cluster-installation/install-application-stack.sh +++ b/code/local-kubernetes-cluster-installation/install-application-stack.sh @@ -47,45 +47,59 @@ fi echo "Targeting user $INSTALLUSER for application-code installation" export KUBECONFIG=/home/$INSTALLUSER/.kube/config kubectl config set-context microk8s -cd /home/$INSTALLUSER +cd "/home/$INSTALLUSER" +pwd # Pull zipped files rm -rf $RELEASEDIRNAME # Clean out any old run rm $RELEASENAME.zip wget https://github.com/BigBitBusInc/kubernetes-automation-toolkit/archive/$RELEASENAME.zip unzip $RELEASENAME.zip - +echo "Tried to download and unzip $RELEASENAME.zip; pwd has these files:" +ls # Postgres -cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/postgres-db/ +echo "Installing Postgres" +cd "/home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/postgres-db/" +pwd helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update helm upgrade --install pgdb bitnami/postgresql -f pg-values.yaml --namespace pg --create-namespace --version 12.2.7 # Monitoring -cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/monitoring/ +echo "Installing Monitoring" +cd "/home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/monitoring/" +pwd helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo add stable https://charts.helm.sh/stable helm repo update helm upgrade --install monitoring-stack prometheus-community/kube-prometheus-stack -f ./prometheus-grafana-monitoring-stack-values.yaml --namespace monitoring --create-namespace --version 12.8.1 # K8s Dashboard -cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/k8sdashboard/ +echo "Installing K8s dashboard" +cd "/home/$INSTALLUSER/$RELEASEDIRNAME/code/k8s-common-code/k8sdashboard/" +pwd helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/ helm repo update helm upgrade --install k8sdashboard kubernetes-dashboard/kubernetes-dashboard -f ./dashboard-values.yaml --namespace dashboard --create-namespace # Backend +echo "Installing BE" kubectl create namespace be -cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/app-code/api/todo-python-django/ +cd "/home/$INSTALLUSER/$RELEASEDIRNAME/code/app-code/api/todo-python-django/" +pwd skaffold run --default-repo localhost:32000 # Frontend +echo "Installing FE" kubectl create namespace fe -cd /home/$INSTALLUSER/$RELEASEDIRNAME/code/app-code/frontend/todo-vuejs/ +cd "/home/$INSTALLUSER/$RELEASEDIRNAME/code/app-code/frontend/todo-vuejs/" +pwd skaffold run --default-repo localhost:32000 +echo "Finishing up" chown -R $INSTALLUSER:$INSTALLUSER /home/$INSTALLUSER/$RELEASEDIRNAME/ -cd /home/$INSTALLUSER +cd "/home/$INSTALLUSER" +pwd rm $RELEASENAME.zip # Print what was deployed for later debugging kubectl get all --all-namespaces diff --git a/code/local-kubernetes-cluster-installation/install-microk8s-on-ubuntu.sh b/code/local-kubernetes-cluster-installation/install-microk8s-on-ubuntu.sh index e7589ee..2eb44df 100755 --- a/code/local-kubernetes-cluster-installation/install-microk8s-on-ubuntu.sh +++ b/code/local-kubernetes-cluster-installation/install-microk8s-on-ubuntu.sh @@ -49,9 +49,9 @@ apt-get install -y fail2ban vim apt-get install unzip # Note - we pegged the Kubernetes version here -snap install microk8s --classic --channel=1.19 curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh +snap install microk8s --classic --channel=1.19 snap install kubectl --classic --channel=1.19 snap install helm --classic --channel=3.4 sleep 60 # Sometimes microk8s needs time to stabilize