项目重构
This commit is contained in:
148
0-部署应用/Oracle-Cloud/k3s集群/2-安装k3集群.sh
Normal file
148
0-部署应用/Oracle-Cloud/k3s集群/2-安装k3集群.sh
Normal file
@@ -0,0 +1,148 @@
|
||||
#!/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 "19000-19500" \
|
||||
--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
|
||||
|
||||
# install by script
|
||||
cat >/root/k3s-install/k3s-config.yaml<<EOF
|
||||
write-kubeconfig-mode: "0644"
|
||||
v: 0
|
||||
log: /root/k3s-install/k3s.log
|
||||
https-listen-port: "16643"
|
||||
advertise-port: "16643"
|
||||
lb-server-port: "16644"
|
||||
advertise-address: "146.56.147.12"
|
||||
node-name: "master-s0"
|
||||
node-ip: "10.10.0.10"
|
||||
node-external-ip: "146.56.147.12"
|
||||
flannel-iface: "wg0-oracle"
|
||||
flannel-backend: "wireguard"
|
||||
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: "19000-19500"
|
||||
cluster-domain: "wdd.io"
|
||||
default-local-storage-path: "/data/k3s/"
|
||||
node-label: "location=seoul"
|
||||
#disable:
|
||||
# - "metrics-server"
|
||||
# - "service-lb"
|
||||
# - "local-storage"
|
||||
agent-token: "woshinibaba"
|
||||
EOF
|
||||
|
||||
curl -sfL https://get.k3s.io | INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml --docker" 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() {
|
||||
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.10.0.20"
|
||||
docker: "true"
|
||||
flannel-iface: "wg0-oracle"
|
||||
node-label: "location=tokyo"
|
||||
EOF
|
||||
cat /root/k3s-install/install-k3s-official.sh| INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:16643" K3S_TOKEN="woshinibaba" sh -
|
||||
|
||||
cat >/root/k3s-install/k3s-config.yaml<<EOF
|
||||
v: 0
|
||||
log: /root/k3s-install/k3s.log
|
||||
node-name: "arm-seoul-2"
|
||||
node-external-ip: "146.56.159.175"
|
||||
node-ip: "10.10.0.19"
|
||||
docker: "true"
|
||||
flannel-iface: "wg0-oracle"
|
||||
node-label: "location=seoul"
|
||||
EOF
|
||||
cat /root/k3s-install/install-k3s-official.sh| INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:16643" K3S_TOKEN="woshinibaba" sh -
|
||||
|
||||
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.10.0.21"
|
||||
flannel-iface: "wg0-oracle"
|
||||
node-label: "location=tokyo"
|
||||
EOF
|
||||
cat /root/k3s-install/install-k3s-official.sh| INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:16643" K3S_TOKEN="woshinibaba" sh -
|
||||
|
||||
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.10.0.22"
|
||||
flannel-iface: "wg0-oracle"
|
||||
node-label: "location=tokyo"
|
||||
EOF
|
||||
cat /root/k3s-install/install-k3s-official.sh| INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC="--config=/root/k3s-install/k3s-config.yaml" K3S_URL="https://146.56.147.12:16643" K3S_TOKEN="woshinibaba" 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: "wg0-oracle"
|
||||
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:16643" K3S_TOKEN="woshinibaba" sh -
|
||||
|
||||
|
||||
|
||||
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.10.0.79"
|
||||
docker: "true"
|
||||
flannel-iface: "wg0-oracle"
|
||||
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:16643" K3S_TOKEN="woshinibaba" sh -
|
||||
|
||||
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.10.0.79"
|
||||
flannel-iface: "wg0-oracle"
|
||||
node-label: "location=hongkong"
|
||||
docker: "true"
|
||||
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:16643" K3S_TOKEN="woshinibaba" sh -
|
||||
Reference in New Issue
Block a user