diff --git a/first_boot.sh b/first_boot.sh index 6e9162d..36502dc 100755 --- a/first_boot.sh +++ b/first_boot.sh @@ -29,22 +29,23 @@ 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 - -#Define Admin user and Password -http POST http://localhost:9000/api/users/admin/init Username="portainer" Password="portainer1234" +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 & #Add the portainer user to the docker group -usermod -aG docker portainer && newgrp docker +usermod -aG docker portainer #Start minikube -sudo -u portainer minikube start --nodes 3 --driver=docker --ports=":30778" --ports=":9001" +sudo -u portainer minikube start --driver=docker --ports=":30778" --ports=":9001" #Add the metrics server to the minikube cluster sudo -u portainer minikube addons enable metrics-server +#Define Admin user and Password +http POST http://localhost:9000/api/users/admin/init Username="portainer" Password="portainer1234" + #Add Portainer Agent to the local kind Kubernetes cluster -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' +sudo -u portainer curl -L https://downloads.portainer.io/portainer-agent-k8s-nodeport.yaml -o /home/portainer/portainer-agent-k8s.yaml; sudo -u portainer kubectl apply -f /home/portainer/portainer-agent-k8s.yaml +sudo -u portainer rm /home/portainer/portainer-agent-k8s.yaml sleep 20 #Get the admin JWT token @@ -62,3 +63,4 @@ port=`docker port minikube | grep 30778 | head -1 | awk '$1=$1' FS=":" OFS=" " | sudo -u portainer http --form POST :9000/api/endpoints \ "Authorization: Bearer $jwt" \ Name="kubernetes" URL="tcp://10.0.2.8:$port" EndpointCreationType=2 TLS="true" TLSSkipVerify="true" TLSSkipClientVerify="true" +