From f2cf3fa534a5172910b66e9286e75fe6d2de48a7 Mon Sep 17 00:00:00 2001 From: Adolfo Delorenzo Date: Tue, 6 Jul 2021 21:12:59 -0600 Subject: [PATCH] fix --- first_boot.sh | 53 ++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/first_boot.sh b/first_boot.sh index 3bdae9d..6e9162d 100755 --- a/first_boot.sh +++ b/first_boot.sh @@ -1,52 +1,53 @@ #!/bin/bash # Install Docker -#apt update -#apt install curl apt-transport-https ca-certificates curl gnupg lsb-release -y -#curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg -#echo \ -# "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ -# $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null -#apt-get update -#apt-get install docker-ce docker-ce-cli containerd.io -y +apt update +apt install curl apt-transport-https ca-certificates curl gnupg lsb-release -y +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg +echo \ + "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +apt-get update +apt-get install docker-ce docker-ce-cli containerd.io -y #Install kubectl -#apt update -#apt-get install -y apt-transport-https ca-certificates curl -#curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg -#echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list -#apt-get update -#apt-get install -y kubectl +apt update +apt-get install -y apt-transport-https ca-certificates curl +curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg +echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list +apt-get update +apt-get install -y kubectl #Create a minikube -#curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb -#dpkg -i minikube_latest_amd64.deb +curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb +mv minikube_latest_amd64.deb /tmp +dpkg -i /tmp/minikube_latest_amd64.deb +rm /tmp/minikube_latest_amd64.deb #Install httpie -#apt -y install httpie +apt -y install httpie #Install Portainer -#docker volume create portainer_data -#docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce +docker volume create portainer_data +docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce #Define Admin user and Password -#http POST http://localhost:9000/api/users/admin/init Username="portainer" Password="portainer1234" +http POST http://localhost:9000/api/users/admin/init Username="portainer" Password="portainer1234" #Add the portainer user to the docker group -#usermod -aG docker portainer && newgrp docker +usermod -aG docker portainer && newgrp docker #Start minikube -#sudo -u portainer minikube start --nodes 2 --driver=none +sudo -u portainer minikube start --nodes 3 --driver=docker --ports=":30778" --ports=":9001" #Add the metrics server to the minikube cluster -#sudo -u portainer minikube addons enable metrics-server +sudo -u portainer minikube addons enable metrics-server #Add Portainer Agent to the local kind Kubernetes cluster -# curl -L https://downloads.portainer.io/portainer-agent-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml -#sleep 15 +sudo -u portainer 'curl -L https://downloads.portainer.io/portainer-agent-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml' +sleep 20 #Get the admin JWT token -#http POST :9000/api/auth Username="portainer" Password="portainer1234" jwt=`http POST :9000/api/auth Username="portainer" Password="portainer1234" | jq '.jwt' | sed 's/^.//' | sed 's/.$//'` #Add local Docker endpoint