From 1a4f913ff7ee21bc82d4f0159c740517e75456c1 Mon Sep 17 00:00:00 2001 From: Wojtek Turowicz Date: Fri, 11 Oct 2024 13:43:31 +0200 Subject: [PATCH 1/8] Create k3s-wg-init.sh --- script/k3s-wg-init.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 script/k3s-wg-init.sh diff --git a/script/k3s-wg-init.sh b/script/k3s-wg-init.sh new file mode 100644 index 0000000..5ed83b9 --- /dev/null +++ b/script/k3s-wg-init.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/k3s-wg-init.sh | sudo sh -- + +TXT_YELLOW=`tput setaf 3` +TXT_NORMAL=`tput sgr0` + +set -e + +if [ `whoami` != root ]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi + +# Disable swap +swapoff -a +sed -i '/swap/s/^\(.*\)$/#\1/g' /etc/fstab + +# Configure K3S +mkdir -p /etc/rancher/k3s +wget -O /etc/rancher/k3s/config.yaml https://raw.githubusercontent.com/Surveily/Images/master/script/k3s/config.yaml +wget -O /etc/multipath.conf https://raw.githubusercontent.com/Surveily/Images/master/script/k3s/multipath.conf + +# Install K3S +curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.27.1+k3s1" sh -s server --disable local-storage --flannel-backend=wireguard-native --flannel-external-ip --node-external-ip=$1 --cluster-init --token "surveily" + +# Configure NVIDIA +k3s kubectl apply -f https://raw.githubusercontent.com/Surveily/Images/master/script/k3s/nvidia.yaml + +# Make sure to `vim /etc/rancher/k3s/config.yaml` and `systemctl start k3s` after this script! +systemctl stop k3s +vim /etc/rancher/k3s/config.yaml +systemctl start k3s From e2c862e72f6191facc33f8563588288c5460d423 Mon Sep 17 00:00:00 2001 From: Wojtek Turowicz Date: Fri, 11 Oct 2024 13:43:44 +0200 Subject: [PATCH 2/8] Update k3s-wg-init.sh --- script/k3s-wg-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/k3s-wg-init.sh b/script/k3s-wg-init.sh index 5ed83b9..e86683b 100644 --- a/script/k3s-wg-init.sh +++ b/script/k3s-wg-init.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/k3s-wg-init.sh | sudo sh -- +# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/k3s-wg-init.sh | sudo sh -s -- TXT_YELLOW=`tput setaf 3` TXT_NORMAL=`tput sgr0` From cde55ff0316d415e311b0ae8a26c9275d5f7e11d Mon Sep 17 00:00:00 2001 From: Wojtek Turowicz Date: Fri, 11 Oct 2024 13:44:39 +0200 Subject: [PATCH 3/8] Create k3s-wg-join-agent.sh --- script/k3s-wg-join-agent.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 script/k3s-wg-join-agent.sh diff --git a/script/k3s-wg-join-agent.sh b/script/k3s-wg-join-agent.sh new file mode 100644 index 0000000..54e7993 --- /dev/null +++ b/script/k3s-wg-join-agent.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/k3s-multi-agent.sh | sudo sh -s -- + +TXT_YELLOW=`tput setaf 3` +TXT_NORMAL=`tput sgr0` + +set -e + +if [ `whoami` != root ]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi + +# Disable swap +swapoff -a +sed -i '/swap/s/^\(.*\)$/#\1/g' /etc/fstab + +# Configure K3S +mkdir -p /etc/rancher/k3s +wget -O /etc/rancher/k3s/config.yaml https://raw.githubusercontent.com/Surveily/Images/master/script/k3s/config.yaml +wget -O /etc/multipath.conf https://raw.githubusercontent.com/Surveily/Images/master/script/k3s/multipath.conf + +# Install K3S +curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.27.1+k3s1" K3S_TOKEN="surveily" sh -s agent --node-external-ip=$1 --server https://$2:6443 From 8927169f8dea6fe852c85420a75ab6b5a4b62a55 Mon Sep 17 00:00:00 2001 From: Wojtek Turowicz Date: Fri, 11 Oct 2024 13:45:03 +0200 Subject: [PATCH 4/8] Update full-22.04.sh --- script/full-22.04.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/full-22.04.sh b/script/full-22.04.sh index a8c1e3c..2dc665a 100644 --- a/script/full-22.04.sh +++ b/script/full-22.04.sh @@ -23,8 +23,8 @@ FILE=/surveily-k3s if [ -f $FILE ]; then echo "File $FILE exists." else - echo "File $FILE not exists." - curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/k3s-multi-agent.sh | sh -s -- 10.100.1.10 + #echo "File $FILE not exists." + #curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/k3s-multi-agent.sh | sh -s -- 10.100.1.10 touch $FILE - reboot + #reboot fi From fcd6212b0ba3a1b85cf3480f328880c2348ab8d7 Mon Sep 17 00:00:00 2001 From: Wojtek Turowicz Date: Fri, 11 Oct 2024 13:50:17 +0200 Subject: [PATCH 5/8] Update k3s-wg-join-agent.sh --- script/k3s-wg-join-agent.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/k3s-wg-join-agent.sh b/script/k3s-wg-join-agent.sh index 54e7993..0c95890 100644 --- a/script/k3s-wg-join-agent.sh +++ b/script/k3s-wg-join-agent.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/k3s-multi-agent.sh | sudo sh -s -- +# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/k3s-wg-join-agent.sh | sudo sh -s -- TXT_YELLOW=`tput setaf 3` TXT_NORMAL=`tput sgr0` From ff75ea2c710050efe205931d60fc9196ca5a0557 Mon Sep 17 00:00:00 2001 From: Wojtek Turowicz Date: Tue, 15 Oct 2024 08:49:04 +0200 Subject: [PATCH 6/8] Create lxd.sh --- script/lxd.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 script/lxd.sh diff --git a/script/lxd.sh b/script/lxd.sh new file mode 100644 index 0000000..923c6e0 --- /dev/null +++ b/script/lxd.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/lxd.sh | sudo bash + +set -e + +if [ `whoami` != root ]; then + echo "Please run this script with sudo:" + echo "sudo $0 $*" + exit 1 +fi + +iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT +iptables -I DOCKER-USER -o lxdbr0 -j ACCEPT +iptables -I DOCKER-USER -i lxdbr0 -o wlp3s0 -j ACCEPT From b60b613fa7cbadaa1ab7890c5789f96c138239f7 Mon Sep 17 00:00:00 2001 From: Wojtek Turowicz Date: Tue, 15 Oct 2024 08:49:46 +0200 Subject: [PATCH 7/8] Update lxd.sh --- script/lxd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lxd.sh b/script/lxd.sh index 923c6e0..c22b6ce 100644 --- a/script/lxd.sh +++ b/script/lxd.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/lxd.sh | sudo bash +# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/lxd.sh | sudo bash set -e From cd3375ff6f77448eea53fb35a1db2f9ba5a448c7 Mon Sep 17 00:00:00 2001 From: Wojtek Turowicz Date: Tue, 15 Oct 2024 09:11:43 +0200 Subject: [PATCH 8/8] Update lxd.sh --- script/lxd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/lxd.sh b/script/lxd.sh index c22b6ce..885fdfa 100644 --- a/script/lxd.sh +++ b/script/lxd.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/lxd.sh | sudo bash +# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/lxd.sh | sudo bash -s -- set -e @@ -12,4 +12,4 @@ fi iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT iptables -I DOCKER-USER -o lxdbr0 -j ACCEPT -iptables -I DOCKER-USER -i lxdbr0 -o wlp3s0 -j ACCEPT +iptables -I DOCKER-USER -i lxdbr0 -o $1 -j ACCEPT