-
-
Save kbruner/1ad917dc4d39dbe0821bcfb782c14c17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ # ssh -o StrictHostKeyChecking=no -i ~cbsd/.ssh/id_rsa ubuntu@10.0.10.10 sudo ip address add 10.0.0.2/32 dev enp0s5:1 | |
~ # ipfw add 300 fwd 10.0.10.10 ip from any to 10.0.0.2 keep-state | |
00300 fwd 10.0.10.10 ip from any to 10.0.0.2 keep-state :default | |
~ # k3sup install \ | |
--host server-0 \ | |
--user ubuntu \ | |
--cluster \ | |
--k3s-channel stable \ | |
--ssh-key ~cbsd/.ssh/id_rsa \ | |
--k3s-extra-args '--cluster-cidr 10.1.0.0/16 --service-cidr 10.2.0.0/16 --cluster-dns 10.2.0.10' | |
Running: k3sup install | |
2020/12/25 17:18:38 server-0 | |
Public IP: server-0 | |
[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-uninstall.sh | |
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env | |
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service | |
[INFO] systemd: Enabling k3s unit | |
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service. | |
[INFO] systemd: Starting k3s | |
Result: [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-uninstall.sh | |
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env | |
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service | |
[INFO] systemd: Enabling k3s unit | |
[INFO] systemd: Starting k3s | |
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service. | |
Saving file to: /root/kubeconfig | |
# Test your cluster with: | |
export KUBECONFIG=/root/kubeconfig | |
kubectl config set-context default | |
kubectl get node -o wide | |
~ # k3sup join \ | |
--host server-1 \ | |
--user ubuntu \ | |
--server \ | |
--server-host kubernetes.k3s.local \ | |
--server-user ubuntu \ | |
--k3s-channel stable \ | |
--ssh-key ~cbsd/.ssh/id_rsa \ | |
--k3s-extra-args '--cluster-cidr 10.1.0.0/16 --service-cidr 10.2.0.0/16 --cluster-dns 10.2.0.10' | |
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-uninstall.sh | |
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env | |
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service | |
[INFO] systemd: Enabling k3s unit | |
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service. | |
[INFO] systemd: Starting k3s | |
Logs: Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service. | |
Output: [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-uninstall.sh | |
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env | |
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service | |
[INFO] systemd: Enabling k3s unit | |
[INFO] systemd: Starting k3s | |
[ repeat for server-2] | |
~ # ssh -o StrictHostKeyChecking=no -i ~cbsd/.ssh/id_rsa ubuntu@10.0.10.11 sudo ip address add 10.0.0.2/32 dev enp0s5:1 | |
~ # ssh -o StrictHostKeyChecking=no -i ~cbsd/.ssh/id_rsa ubuntu@10.0.10.12 sudo ip address add 10.0.0.2/32 dev enp0s5:1 | |
~ # export KUBECONFIG=/root/kubeconfig | |
~ # kubectl config set-context default | |
Context "default" modified. | |
~ # sed -I "" -e 's/127.0.0.1/10.0.0.2/' $KUBECONFIG | |
~ # kubectl get nodes -o wide | |
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME | |
server-0 Ready etcd,master 15m 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 19s 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 9m20s v1.19.5+k3s2 10.0.10.12 <none> Ubuntu 20.04.1 LTS 5.4.0-42-generic containerd://1.4.3-k3s1 | |
~ # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create VIP on server-0 | |
ssh -o StrictHostKeyChecking=no -i ~cbsd/.ssh/id_rsa ubuntu@10.0.10.10 sudo ip address add 10.0.0.2/32 dev enp0s5:1 | |
ipfw add 300 fwd 10.0.10.10 ip from any to 10.0.0.2 keep-state | |
k3sup install \ | |
--host server-0 \ | |
--user ubuntu \ | |
--cluster \ | |
--k3s-channel stable \ | |
--ssh-key ~cbsd/.ssh/id_rsa \ | |
--k3s-extra-args '--cluster-cidr 10.1.0.0/16 --service-cidr 10.2.0.0/16 --cluster-dns 10.2.0.10' | |
k3sup join \ | |
--host server-1 \ | |
--user ubuntu \ | |
--server \ | |
--server-host kubernetes.k3s.local \ | |
--server-user ubuntu \ | |
--k3s-channel stable \ | |
--ssh-key ~cbsd/.ssh/id_rsa \ | |
--k3s-extra-args '--cluster-cidr 10.1.0.0/16 --service-cidr 10.2.0.0/16 --cluster-dns 10.2.0.10' | |
k3sup join \ | |
--host server-2 \ | |
--user ubuntu \ | |
--server \ | |
--server-host kubernetes.k3s.local \ | |
--server-user ubuntu \ | |
--k3s-channel stable \ | |
--ssh-key ~cbsd/.ssh/id_rsa \ | |
--k3s-extra-args '--cluster-cidr 10.1.0.0/16 --service-cidr 10.2.0.0/16 --cluster-dns 10.2.0.10' | |
# Create VIPs on server-1 and server-2 | |
ssh -o StrictHostKeyChecking=no -i ~cbsd/.ssh/id_rsa ubuntu@10.0.10.11 sudo ip address add 10.0.0.2/32 dev enp0s5:1 | |
ssh -o StrictHostKeyChecking=no -i ~cbsd/.ssh/id_rsa ubuntu@10.0.10.12 sudo ip address add 10.0.0.2/32 dev enp0s5:1 | |
export KUBECONFIG=/root/kubeconfig | |
kubectl config set-context default | |
# In case the server endpoint is set to localhost, we'll change it to our VIP | |
sed -I "" -e 's/127.0.0.1/10.0.0.2/' $KUBECONFIG | |
kubectl get nodes -o wide |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment