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 diff --git a/script/k3s-wg-init.sh b/script/k3s-wg-init.sh new file mode 100644 index 0000000..e86683b --- /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 -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" 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 diff --git a/script/k3s-wg-join-agent.sh b/script/k3s-wg-join-agent.sh new file mode 100644 index 0000000..0c95890 --- /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-wg-join-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 diff --git a/script/lxd.sh b/script/lxd.sh new file mode 100644 index 0000000..885fdfa --- /dev/null +++ b/script/lxd.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/lxd.sh | sudo bash -s -- + +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 $1 -j ACCEPT