Files
shell-scripts/部署应用/Oracle-Cloud/k3s集群/4-install k3s with headscale.sh
2023-05-15 16:49:09 +08:00

153 lines
4.8 KiB
Bash

#!/bin/bash
server(){
# install from binary
# https://github.com/k3s-io/k3s/releases/tag/v1.22.3+k3s1
k3s server \
--write-kubeconfig-mode "0644" \
--https-listen-port "16643" \
--advertise-port "16643" \
--lb-server-port "16644" \
--advertise-address "146.56.147.12" \
--node-name "master-s0" \
--bind-address "0.0.0.0" \
--cluster-cidr "10.74.0.0/16" \
--service-cidr "10.100.0.0/16" \
--cluster-dns "10.100.0.10" \
--service-node-port-range "20000-22000" \
--cluster-domain "wdd.io" \
--default-local-storage-path "/data/k3s/" \
--no-deploy "metrics-server" \
--no-deploy "coredns" \
--no-deploy "servicelb" \
--node-label "location=seoul" \
--disable-network-policy \
--docker \
--agent-token "woshinibaba" \
--cluster-init
# 2022-12-2 use this
# install by script
mkdir /root/k3s-install/
cat >/root/k3s-install/k3s-config.yaml<<EOF
write-kubeconfig-mode: "0644"
v: 0
log: /root/k3s-install/k3s.log
https-listen-port: "6643"
advertise-port: "6643"
lb-server-port: "6644"
advertise-address: "146.56.147.12"
node-name: "master-s0"
node-ip: "10.20.0.19"
node-external-ip: "146.56.147.12"
flannel-iface: "tailscale0"
flannel-backend: "vxlan"
bind-address: "0.0.0.0"
cluster-cidr: "10.100.0.0/16"
service-cidr: "10.74.0.0/16"
cluster-dns: "10.74.0.10"
service-node-port-range: "20000-22000"
cluster-domain: "wdd.io"
default-local-storage-path: "/data/k3s/"
node-label: "location=seoul"
docker: "true"
disable:
- "metrics-server"
#- "service-lb"
#- "local-storage"
agent-token: "woshinibaba"
EOF
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.24.8+k3s1 INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml --docker --cluster-init" sh -
cat /root/k3s-install/install-k3s-official.sh | INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml --docker" sh -
}
agent() {
mkdir /root/k3s-install
cat >/root/k3s-install/k3s-config.yaml<<EOF
v: 0
log: /root/k3s-install/k3s.log
node-name: "node-tokyo-0"
node-external-ip: "150.230.198.103"
node-ip: "10.20.0.16"
docker: "true"
flannel-iface: "tailscale0"
node-label: "location=tokyo"
EOF
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.24.8+k3s1 INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:6643" K3S_TOKEN="woshinibaba" sh -
mkdir /root/k3s-install
cat >/root/k3s-install/k3s-config.yaml<<EOF
v: 0
log: /root/k3s-install/k3s.log
node-name: "seoul-amd64-01"
node-external-ip: "140.238.8.73"
node-ip: "10.20.0.21"
flannel-iface: "tailscale0"
node-label: "location=seoul"
EOF
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:6643" K3S_TOKEN="woshinibaba" INSTALL_K3S_VERSION=v1.24.8+k3s1 sh -
mkdir /root/k3s-install
cat >/root/k3s-install/k3s-config.yaml<<EOF
v: 0
log: /root/k3s-install/k3s.log
node-name: "node-tokyo-1"
node-external-ip: "140.238.63.37"
node-ip: "10.20.0.18"
flannel-iface: "tailscale0"
node-label: "location=tokyo"
EOF
cat /root/k3s-install/install-k3s-official.sh|
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:6643" K3S_TOKEN="woshinibaba" INSTALL_K3S_VERSION=v1.24.8+k3s1 sh -
mkdir /root/k3s-install
cat >/root/k3s-install/k3s-config.yaml<<EOF
v: 0
log: /root/k3s-install/k3s.log
node-name: "node-tokyo-2"
node-external-ip: "140.238.52.228"
node-ip: "10.20.0.17"
flannel-iface: "tailscale0"
node-label: "location=tokyo"
EOF
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:6643" K3S_TOKEN="woshinibaba" INSTALL_K3S_VERSION=v1.24.8+k3s1 sh -
cat >/root/k3s-install/k3s-config.yaml<<EOF
v: 0
log: /root/k3s-install/k3s.log
node-name: "node-tc-sh"
node-external-ip: "42.192.52.227"
node-ip: "10.10.0.71"
flannel-iface: "tailscale0"
node-label: "location=shanghai"
EOF
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:6643" K3S_TOKEN="woshinibaba" sh -
mkdir /root/k3s-install
cat >/root/k3s-install/k3s-config.yaml<<EOF
v: 0
log: /root/k3s-install/k3s.log
node-name: "node-tc-hk"
node-external-ip: "43.154.83.213"
node-ip: "10.20.0.13"
docker: "true"
flannel-iface: "tailscale0"
node-label: "location=hongkong"
EOF
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:6643" K3S_TOKEN="woshinibaba" INSTALL_K3S_VERSION=v1.24.8+k3s1 sh -
}