
环境规划
Role | IP |
---|
K3S-Master-01 | 10.0.0.123 |
K3S-Node-01 | 10.0.0.125 |
Software | Version |
---|
K3S | v1.32.5+k3s1 (8e8f2a47) |
Kubectl | v1.32.5+k3s1 |
OS | Debian 12 |
Master
部署Master
root@k3s-server-01:~# curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC='server --tls-san $(curl ip.sb)' sh -
[INFO] Finding release for channel stable
[INFO] Using v1.32.5+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.32.5+k3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.32.5+k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[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] Host iptables-save/iptables-restore tools not found
[INFO] Host ip6tables-save/ip6tables-restore tools not found
[INFO] systemd: Starting k3s
root@k3s-server-01:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k3s-server-01 Ready control-plane,master 17s v1.32.5+k3s1
获取Token
# Node 节点接入集群使用
root@k3s-server-01:~# cat /var/lib/rancher/k3s/server/node-token
Node
root@k3s-node-01:~# curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https://10.0.0.123:6443 K3S_TOKEN="K10574282c2099e7d12e30256cdc99879525c7e2a630e32628a2faa255777076e01::server:eb6f3b6b1cfdbc027d32a637c4c31ff9" sh -
[INFO] Finding release for channel stable
[INFO] Using v1.32.5+k3s1 as release
[INFO] Downloading hash rancher-mirror.rancher.cn/k3s/v1.32.5-k3s1/sha256sum-amd64.txt
[INFO] Downloading binary rancher-mirror.rancher.cn/k3s/v1.32.5-k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[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] Host iptables-save/iptables-restore tools not found
[INFO] Host ip6tables-save/ip6tables-restore tools not found
[INFO] systemd: Starting k3s-agent