68 lines
2.8 KiB
Bash
Executable File
68 lines
2.8 KiB
Bash
Executable File
#!/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
|
|
|
|
#Install kind kubernetes
|
|
# apt -y install golang-go
|
|
# GO111MODULE="on" go get sigs.k8s.io/kind@v0.11.1
|
|
# echo 'export PATH=$PATH:/root/go/bin' >> /root/.bashrc && source /root/.bashrc
|
|
|
|
#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
|
|
|
|
#Create a kind cluster
|
|
#cat <<EOF >> portainer.yaml
|
|
## a cluster with 3 control-plane nodes and 3 workers
|
|
#kind: Cluster
|
|
#apiVersion: kind.x-k8s.io/v1alpha4
|
|
#nodes:
|
|
#- role: control-plane
|
|
# extraPortMappings:
|
|
# - containerPort: 30778
|
|
# hostPort: 30778
|
|
#- role: worker
|
|
#- role: worker
|
|
#- role: worker
|
|
#EOF
|
|
#kind create cluster --config portainer.yaml
|
|
|
|
#Install the Metrics Server
|
|
#kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
|
|
|
|
#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
|
|
|
|
#Define Admin user and Password
|
|
#http POST http://localhost:9000/api/users/admin/init Username="portainer" Password="portainer"
|
|
|
|
#Add local Docker endpoint
|
|
#http --form POST :9000/api/endpoints \
|
|
#"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJwb3J0YWluZXIiLCJyb2xlIjoxLCJleHAiOjE2MjU2MzUxNzB9.RF6-DxP_HAdRwkpi3fPTr7YPjzTBsaioi9Au3njY0YI" \
|
|
#Name="docker" EndpointCreationType=1
|
|
|
|
#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 30
|
|
|
|
#Add local Kubernetes endpoint
|
|
#http --form POST :9000/api/endpoints \
|
|
#"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJwb3J0YWluZXIiLCJyb2xlIjoxLCJleHAiOjE2MjU2MzUxNzB9.RF6-DxP_HAdRwkpi3fPTr7YPjzTBsaioi9Au3njY0YI" \
|
|
#Name="kubernetes" URL="tcp://10.0.2.8:9001" EndpointCreationType=2
|