diff --git a/cicd/k3s-multi-master-service-proxy/kube-loxilb.yml b/cicd/k3s-multi-master-service-proxy/kube-loxilb.yml index 0f1ed7a5c..f48008297 100644 --- a/cicd/k3s-multi-master-service-proxy/kube-loxilb.yml +++ b/cicd/k3s-multi-master-service-proxy/kube-loxilb.yml @@ -128,6 +128,7 @@ spec: - --externalCIDR=192.168.80.200/32 #- --setBGP=64512 - --setRoles=0.0.0.0 + - --excludeRoleList=192.168.80.101,192.168.80.102 #- --monitor #- --setBGP #- --setLBMode=1 diff --git a/cicd/k3s-multi-master-service-proxy/master1.sh b/cicd/k3s-multi-master-service-proxy/master1.sh index f1929464b..d3d996490 100755 --- a/cicd/k3s-multi-master-service-proxy/master1.sh +++ b/cicd/k3s-multi-master-service-proxy/master1.sh @@ -3,7 +3,7 @@ sudo su ip addr add 192.168.80.80/32 dev lo apt-get update && apt-get install ipvsadm ipset -y export MASTER_IP=$(ip a |grep global | grep -v '10.0.2.15' | grep -v '192.168.90' | grep '192.168.80' | awk '{print $2}' | cut -f1 -d '/') -curl -fL https://get.k3s.io | sh -s - server --node-ip=192.168.80.10 --disable servicelb --disable traefik --cluster-init --node-external-ip=192.168.80.80 --disable-cloud-controller --flannel-iface=eth2 --kube-proxy-arg proxy-mode=ipvs --disable-network-policy --kube-apiserver-arg=kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname +curl -fL https://get.k3s.io | sh -s - server --node-ip=192.168.80.10 --disable servicelb --disable traefik --cluster-init --disable-cloud-controller --flannel-iface=eth2 --kube-proxy-arg proxy-mode=ipvs --disable-network-policy --kube-apiserver-arg=kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --node-name master1 --tls-san 192.168.80.80 --node-external-ip=192.168.80.10 kubectl taint nodes master1 node.cloudprovider.kubernetes.io/uninitialized:NoSchedule- curl -sfL https://github.com/loxilb-io/loxilb-ebpf/raw/main/kprobe/install.sh | sh - sleep 60 diff --git a/cicd/k3s-multi-master-service-proxy/master2.sh b/cicd/k3s-multi-master-service-proxy/master2.sh index 33afc7727..18a1da78e 100755 --- a/cicd/k3s-multi-master-service-proxy/master2.sh +++ b/cicd/k3s-multi-master-service-proxy/master2.sh @@ -7,7 +7,7 @@ sudo mkdir -p /etc/loxilb sudo cp /vagrant/lbconfig.txt /etc/loxilb/ sudo cp /vagrant/EPconfig.txt /etc/loxilb/ curl -sfL https://github.com/loxilb-io/loxilb-ebpf/raw/main/kprobe/install.sh | sh - -curl -fL https://get.k3s.io | K3S_TOKEN=${NODE_TOKEN} sh -s - server --server https://192.168.80.10:6443 --disable traefik --disable servicelb --node-ip=192.168.80.11 --node-external-ip=192.168.80.80 --disable-cloud-controller -t ${NODE_TOKEN} --flannel-iface=eth2 --kube-proxy-arg proxy-mode=ipvs --disable-network-policy --kube-apiserver-arg=kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname +curl -fL https://get.k3s.io | K3S_TOKEN=${NODE_TOKEN} sh -s - server --server https://192.168.80.10:6443 --disable traefik --disable servicelb --node-ip=192.168.80.11 --node-external-ip=192.168.80.80 --disable-cloud-controller -t ${NODE_TOKEN} --flannel-iface=eth2 --kube-proxy-arg proxy-mode=ipvs --disable-network-policy --kube-apiserver-arg=kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --node-name master2 --tls-san 192.168.80.80 --node-external-ip=192.168.80.11 sed -i -e "s/127.0.0.1/192.168.80.80/g" /etc/rancher/k3s/k3s.yaml kubectl taint nodes master2 node.cloudprovider.kubernetes.io/uninitialized:NoSchedule- /vagrant/wait_ready.sh diff --git a/cicd/k3s-multi-master-service-proxy/master3.sh b/cicd/k3s-multi-master-service-proxy/master3.sh index 42e7ef684..1ff0f2c31 100755 --- a/cicd/k3s-multi-master-service-proxy/master3.sh +++ b/cicd/k3s-multi-master-service-proxy/master3.sh @@ -7,7 +7,7 @@ sudo mkdir -p /etc/loxilb sudo cp /vagrant/lbconfig.txt /etc/loxilb/ sudo cp /vagrant/EPconfig.txt /etc/loxilb/ curl -sfL https://github.com/loxilb-io/loxilb-ebpf/raw/main/kprobe/install.sh | sh - -curl -fL https://get.k3s.io | K3S_TOKEN=${NODE_TOKEN} sh -s - server --server https://192.168.80.10:6443 --disable traefik --disable servicelb --node-ip=192.168.80.12 --node-external-ip=192.168.80.80 --disable-cloud-controller -t ${NODE_TOKEN} --flannel-iface=eth2 --kube-proxy-arg proxy-mode=ipvs --disable-network-policy --kube-apiserver-arg=kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname +curl -fL https://get.k3s.io | K3S_TOKEN=${NODE_TOKEN} sh -s - server --server https://192.168.80.10:6443 --disable traefik --disable servicelb --node-ip=192.168.80.12 --disable-cloud-controller -t ${NODE_TOKEN} --flannel-iface=eth2 --kube-proxy-arg proxy-mode=ipvs --disable-network-policy --kube-apiserver-arg=kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --node-name master3 --tls-san 192.168.80.80 --node-external-ip=192.168.80.12 kubectl taint nodes master2 node.cloudprovider.kubernetes.io/uninitialized:NoSchedule- sed -i -e "s/127.0.0.1/192.168.80.80/g" /etc/rancher/k3s/k3s.yaml sudo kubectl apply -f /vagrant/kube-loxilb.yml diff --git a/cicd/k3s-multi-master-service-proxy/worker.sh b/cicd/k3s-multi-master-service-proxy/worker.sh index ece4dad35..404b2bcae 100644 --- a/cicd/k3s-multi-master-service-proxy/worker.sh +++ b/cicd/k3s-multi-master-service-proxy/worker.sh @@ -3,9 +3,12 @@ apt-get update && apt-get install ipvsadm ipset -y export WORKER_ADDR=$(ip a |grep global | grep -v '10.0.2.15' | grep '192.168.80' | awk '{print $2}' | cut -f1 -d '/') export MASTER_ADDR=$(cat /vagrant/master-ip) export NODE_TOKEN=$(cat /vagrant/node-token) +mkdir -p /etc/rancher/k3s/ +#If you need to login to docker registry +#cp -f /vagrant/registries.yaml /etc/rancher/k3s/registries.yaml curl -sfL https://github.com/loxilb-io/loxilb-ebpf/raw/main/kprobe/install.sh | sh - mkdir -p /etc/rancher/k3s cp -f /vagrant/k3s.yaml /etc/rancher/k3s/k3s.yaml -curl -sfL https://get.k3s.io | K3S_URL='https://192.168.80.80:6443' K3S_TOKEN=${NODE_TOKEN} sh -s - agent --server https://192.168.80.80:6443 --node-ip=${WORKER_ADDR} --node-external-ip=${WORKER_ADDR} -t ${NODE_TOKEN} --flannel-iface=eth1 --kube-proxy-arg proxy-mode=ipvs --disable-apiserver-lb +curl -sfL https://get.k3s.io | K3S_URL='https://192.168.80.80:6443' K3S_TOKEN=${NODE_TOKEN} sh -s - agent --server https://192.168.80.80:6443 --node-ip=${WORKER_ADDR} --node-external-ip=${WORKER_ADDR} -t ${NODE_TOKEN} --flannel-iface=eth1 --kube-proxy-arg proxy-mode=ipvs --disable-apiserver-lb --node-name worker-${WORKER_ADDR} /vagrant/wait_ready.sh sysctl net.core.netdev_max_backlog=10000