Server cluster (3) Cloud servers build K3S cluster

1. Networking

Reference article:

Server cluster (2) WireGuard networking
https://blog.tsinbei.com/archives/621/

2. Install K3S cluster

2.1, Master node

implement

Bash
1
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - --node-external-ip 1.x.x.x --advertise-address 1.x.x.x -- node-ip 192.168.100.1 --flannel-iface wg0
  • --node-external-ip 1.x.x.x specifies the public IP
  • --advertise-address 1.x.x.x specifies the communication address, which can be a public IP or a domain name resolved to this IP
  • -node-ip 192.168.100.1 specifies the virtual IP of the intranet of the node
  • --flannel-iface wg0 specifies the virtual NIC

After the installation is complete, execute

Bash
1
systemctl status k3s

Check the operating status, execute

Bash
1
kubectl get pods -A

View container status.

2.2, Agent node

execute first

Bash
1
cat /var/lib/rancher/k3s/server/node-token

Take note of K3S_TOKEN,
K3S_URL defaults to the IP of the Master node: 6443.

implement

Bash
1
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https://192.168.100.1:6443 K3S_TOKEN=xxxxx sh -s - --node-external- ip 121.x.x.x --node-ip 192.168.100.2 --flannel-iface wg0

2.3, debugging

Execute on the Master node

Bash
1
kubectl get nodes -o wide

Check the Agent node status.

3. Reference

Multi-cloud to build K3S cluster
https://www.cnsre.cn/posts/211119132529/

Server cluster (3) Cloud servers build K3S cluster

https://blog.tsinbei.com/en/archives/625/

Author
Hsukqi Lee
Posted on

2022-08-22

Edited on

2022-08-22

Licensed under

CC BY-NC-ND 4.0

Comments

Name
Mail
Site
None yet