41 lines
1.3 KiB
Bash
Executable File
41 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
ssh_master=$(cat tmp/master_ssh_command)
|
|
ssh_node1=$(cat tmp/node1_ssh_command)
|
|
ssh_node2=$(cat tmp/node2_ssh_command)
|
|
ssh_node3=$(cat tmp/node3_ssh_command)
|
|
ssh_node4=$(cat tmp/node4_ssh_command)
|
|
sleep 5
|
|
echo Master SSH command: $ssh_master | grep ssh
|
|
|
|
$ssh_master curl -o /root/get_k3s.sh https://get.k3s.io
|
|
$ssh_master chmod +x /root/get_k3s.sh
|
|
$ssh_node1 curl -o /root/get_k3s.sh https://get.k3s.io
|
|
$ssh_node1 chmod +x /root/get_k3s.sh
|
|
$ssh_node2 curl -o /root/get_k3s.sh https://get.k3s.io
|
|
$ssh_node2 chmod +x /root/get_k3s.sh
|
|
$ssh_node3 curl -o /root/get_k3s.sh https://get.k3s.io
|
|
$ssh_node3 chmod +x /root/get_k3s.sh
|
|
$ssh_node4 curl -o /root/get_k3s.sh https://get.k3s.io
|
|
$ssh_node4 chmod +x /root/get_k3s.sh
|
|
|
|
$ssh_master /root/get_k3s.sh server --cluster-init
|
|
master_ip=$(echo $ssh_master | cut -d '@' -f2)
|
|
sleep 10
|
|
token=$($ssh_master cat /var/lib/rancher/k3s/server/node-token)
|
|
|
|
worker_cmd="K3S_URL='https://${master_ip}:6443' K3S_TOKEN='${token}' /root/get_k3s.sh"
|
|
|
|
$ssh_node1 $worker_cmd &
|
|
$ssh_node2 $worker_cmd &
|
|
$ssh_node3 $worker_cmd &
|
|
$ssh_node4 $worker_cmd &
|
|
|
|
sleep 20
|
|
|
|
echo
|
|
echo KUBERNETES INSTALLED! PLEASE FIND BELOW THE ACTIVE NODES AND PODS:
|
|
$ssh_master kubectl get nodes,pods -A
|
|
|
|
echo You can SSH into the nodes to run kubectl commands:
|
|
cat tmp/*_command
|