Skip to content

Instantly share code, notes, and snippets.

@kbruner
Last active December 26, 2020 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbruner/dde0b5716aaa586d684f598827312ad9 to your computer and use it in GitHub Desktop.
Save kbruner/dde0b5716aaa586d684f598827312ad9 to your computer and use it in GitHub Desktop.
~ # for i in 0 1 2; do
k3sup join \
--host agent-$i \
--user ubuntu \
--server-host kubernetes.k3s.local \
--server-user ubuntu \
--k3s-channel stable \
--ssh-key ~cbsd/.ssh/id_rsa
done
Running: k3sup join
Server IP: kubernetes.k3s.local
K1094729103bf24c9e6fc312577915112324a2a3d940ac670f87cb7d8de8804625f::server:19433d7161596d0dac7d9ec13a5a91e3
[INFO] Finding release for channel stable
[INFO] Using v1.19.5+k3s2 as release
[INFO] Downloading hash https://github.com/rancher/k3s/releases/download/v1.19.5+k3s2/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/rancher/k3s/releases/download/v1.19.5+k3s2/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-agent-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s-agent.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s-agent.service
[INFO] systemd: Enabling k3s-agent unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s-agent.service → /etc/systemd/system/k3s-agent.service.
[INFO] systemd: Starting k3s-agent
Logs: Created symlink /etc/systemd/system/multi-user.target.wants/k3s-agent.service → /etc/systemd/system/k3s-agent.service.
[ repeats for agent-1 and agent-2 ]
~ # ipfw delete 300
~ # ipfw add 300 prob 0.33 fwd 10.0.10.10 ip from any to 10.0.0.2 keep-state
00300 prob 0.330000 fwd 10.0.10.10 ip from any to 10.0.0.2 keep-state :default
~ # ipfw add 301 prob 0.5 fwd 10.0.10.11 ip from any to 10.0.0.2 keep-state
00301 prob 0.500000 fwd 10.0.10.11 ip from any to 10.0.0.2 keep-state :default
~ # ipfw add 302 fwd 10.0.10.12 ip from any to 10.0.0.2 keep-state
00302 fwd 10.0.10.12 ip from any to 10.0.0.2 keep-state :default
~ # kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
agent-0 Ready <none> 2m43s v1.19.5+k3s2 10.0.10.20 <none> Ubuntu 20.04.1 LTS 5.4.0-42-generic containerd://1.4.3-k3s1
agent-1 Ready <none> 2m35s v1.19.5+k3s2 10.0.10.21 <none> Ubuntu 20.04.1 LTS 5.4.0-42-generic containerd://1.4.3-k3s1
agent-2 Ready <none> 2m26s v1.19.5+k3s2 10.0.10.22 <none> Ubuntu 20.04.1 LTS 5.4.0-42-generic containerd://1.4.3-k3s1
server-0 Ready etcd,master 88m v1.19.5+k3s2 10.0.10.10 <none> Ubuntu 20.04.1 LTS 5.4.0-42-generic containerd://1.4.3-k3s1
server-1 Ready etcd,master 73m v1.19.5+k3s2 10.0.10.11 <none> Ubuntu 20.04.1 LTS 5.4.0-42-generic containerd://1.4.3-k3s1
server-2 Ready etcd,master 82m v1.19.5+k3s2 10.0.10.12 <none> Ubuntu 20.04.1 LTS 5.4.0-42-generic containerd://1.4.3-k3s1
~ #
for i in 0 1 2; do
k3sup join \
--host agent-$i \
--user ubuntu \
--server-host kubernetes.k3s.local \
--server-user ubuntu \
--k3s-channel stable \
--ssh-key ~cbsd/.ssh/id_rsa
done
# Remove temporary firewall rule
ipfw delete 300
# Create round-robin firewall rules
ipfw add 300 prob 0.33 fwd 10.0.10.10 ip from any to 10.0.0.2 keep-state
ipfw add 301 prob 0.5 fwd 10.0.10.11 ip from any to 10.0.0.2 keep-state
ipfw add 302 fwd 10.0.10.12 ip from any to 10.0.0.2 keep-state
kubectl get nodes -o wide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment