apt-get install wireguard-tools
Generate private key
wg genkey | tee server.key | wg pubkey > server.pub
[Interface]
PrivateKey=$(Server private key)
Address=172.16.42.1
ListenPort=51820
[Peer]
PublicKey=$(Client public key)
AllowedIPs=172.16.42.2
PersistentKeepAlive=30
[Interface]
PrivateKey=$(Client private key)
Address=172.16.42.2
[Peer]
PublicKey=$(Server public key)
AllowedIPs=172.16.42.1/24
Endpoint=$(server ip):51820
PersistentKeepAlive=25
curl -sfL https://get.k3s.io | sh -
Get k3s token, it use at installing k3s at worker side.
cat /var/lib/rancher/k3s/server/node-token
curl -sfL https://get.k3s.io | K3S_URL=https://172.16.42.1:6443 K3S_TOKEN=$(YOUR K3S TOKEN) sh -