This commit is contained in:
Adolfo Delorenzo 2021-07-06 22:03:53 -06:00
parent bb8c94c336
commit 0b63834065

View File

@ -29,22 +29,23 @@ apt -y install httpie
#Install Portainer #Install Portainer
docker volume create portainer_data 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 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"
#Add the portainer user to the docker group #Add the portainer user to the docker group
usermod -aG docker portainer && newgrp docker usermod -aG docker portainer
#Start minikube #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 #Add the metrics server to the minikube cluster
sudo -u portainer minikube addons enable metrics-server 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 #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 sleep 20
#Get the admin JWT token #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 \ sudo -u portainer http --form POST :9000/api/endpoints \
"Authorization: Bearer $jwt" \ "Authorization: Bearer $jwt" \
Name="kubernetes" URL="tcp://10.0.2.8:$port" EndpointCreationType=2 TLS="true" TLSSkipVerify="true" TLSSkipClientVerify="true" Name="kubernetes" URL="tcp://10.0.2.8:$port" EndpointCreationType=2 TLS="true" TLSSkipVerify="true" TLSSkipClientVerify="true"