Last active
January 11, 2026 19:12
-
-
Save Nurlan199206/73ee6c80b8560a8c7f2b229e767e2203 to your computer and use it in GitHub Desktop.
k3s cluster alpine
This file contains hidden or 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
| export PS1='\u@\h:\W# ' - /etc/profile для удобного отображения текущей ssh сессии | |
| sed -i '/community/s/^#//' /etc/apk/repositories | |
| apk add curl sudo mc htop iptables ip6tables | |
| rc-update add k3s default | |
| service k3s start | |
| rc-update show | |
| rc-status | |
| ======================================================================================================================== | |
| systemctl status k3s | |
| /usr/local/bin/k3s-uninstall.sh | |
| rm -rf /var/lib/rancher/k3s | |
| rm -rf /etc/rancher/k3s | |
| rm -rf /var/lib/rancher/k3s | |
| rm -rf /var/lib/rancher | |
| rm -rf /var/lib/kubelet | |
| rm -rf /etc/cni | |
| rm -rf /var/lib/cni | |
| rm -rf /opt/cni | |
| rm -rf /run/k3s | |
| rm -rf /run/flannel | |
| rm -rf ~/.kube | |
| =====================================================MASTER NODES=========================================================== | |
| curl -sfL https://get.k3s.io | sh -s - server \ | |
| --cluster-init \ | |
| --tls-san 192.168.100.20 \ | |
| --tls-san 192.168.100.21 \ | |
| --tls-san k3s.example.com \ | |
| --disable traefik \ | |
| --write-kubeconfig-mode 644 | |
| curl -sfL https://get.k3s.io | sh -s - server \ | |
| --server https://192.168.100.20:6443 \ | |
| --token K10f8b374a407feabe86c2324522363068b61a2ae14f71b8b2714b4f7aded7c4306::server:c35a5712ce0a2522e2b8dd174c858ea2 \ | |
| --tls-san 192.168.100.20 \ | |
| --tls-san=192.168.100.22 \ | |
| --tls-san=k3s.example.com \ | |
| --disable=traefik \ | |
| --debug | |
| curl -sfL https://get.k3s.io | sh -s - server \ | |
| --server https://192.168.100.20:6443 \ | |
| --token K10f8b374a407feabe86c2324522363068b61a2ae14f71b8b2714b4f7aded7c4306::server:c35a5712ce0a2522e2b8dd174c858ea2 \ | |
| --tls-san 192.168.100.20 \ | |
| --tls-san=192.168.100.23 \ | |
| --tls-san=k3s.example.com \ | |
| --disable=traefik | |
| ==================================================WORKER NODES=============================================================== | |
| curl -sfL https://get.k3s.io | K3S_URL=https://192.168.100.20:6443 K3S_TOKEN=K10f8b374a407feabe86c2324522363068b61a2ae14f71b8b2714b4f7aded7c4306::server:c35a5712ce0a2522e2b8dd174c858ea2 sh - | |
| =====================================================flux cd integration ==================================================== | |
| mkdir -p /root/.kube | |
| cat /etc/rancher/k3s/k3s.yaml >> /root/.kube | |
| =====================================================haproxy================================================================= | |
| global | |
| log 127.0.0.1 local2 | |
| pidfile /var/run/haproxy.pid | |
| maxconn 4000 | |
| daemon | |
| defaults | |
| mode http | |
| log global | |
| option dontlognull | |
| option http-server-close | |
| option redispatch | |
| retries 3 | |
| timeout http-request 10s | |
| timeout queue 1m | |
| timeout connect 10s | |
| timeout client 1m | |
| timeout server 1m | |
| timeout http-keep-alive 10s | |
| timeout check 10s | |
| maxconn 3000 | |
| listen api-server-6443 | |
| bind 192.168.100.20:6443 | |
| mode tcp | |
| server master1 192.168.100.21:6443 check inter 1s | |
| server master2 192.168.100.22:6443 check inter 1s | |
| server master3 192.168.100.23:6443 check inter 1s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment