K3s 离线安装
1.安装Server
curl -fL https://github.com/rancher/k3s/releases/download/v1.0.0/k3s -o k3s

curl -fL https://github.com/rancher/k3s/releases/download/v1.0.0/k3s-airgap-images-amd64.tar -o k3s-airgap-images-amd64.tar

curl -fL https://gitee.com/mirrors/k3s/raw/master/install.sh -o install-k3s.sh && sudo chmod +x ./install-k3s.sh

sudo cp ./k3s -p /usr/local/bin/k3s && sudo chmod +x /usr/local/bin/k3s

sudo mkdir -p /var/lib/rancher/k3s/agent/images/ && sudo cp ./k3s-airgap-images-amd64.tar /var/lib/rancher/k3s/agent/images/k3s-airgap-images.tar

sudo INSTALL_K3S_SKIP_DOWNLOAD=true ./install-k3s.sh

2.安装Agent
curl -fL https://github.com/rancher/k3s/releases/download/v1.0.0/k3s-armhf -o k3s-armhf

curl -fL https://github.com/rancher/k3s/releases/download/v1.0.0/k3s-airgap-images-arm.tar -o k3s-airgap-images-arm.tar

curl -fL https://gitee.com/mirrors/k3s/raw/master/install.sh -o install-k3s.sh && sudo chmod +x ./install-k3s.sh

sudo cp ./k3s-armhf -p /usr/local/bin/k3s && sudo chmod +x /usr/local/bin/k3s

sudo mkdir -p /var/lib/rancher/k3s/agent/images/ && sudo cp ./k3s-airgap-images-arm.tar /var/lib/rancher/k3s/agent/images/k3s-airgap-images.tar

sudo INSTALL_K3S_SKIP_DOWNLOAD=true K3S_URL=https://$[SERVER_IP]:6443 K3S_TOKEN=$[NODE_TOKEN] ./install-k3s.sh

3.注册节点

在Server中运行

sudo cat /var/lib/rancher/k3s/server/node-token

例如: K10fbfc94108bb3449b4ff174392bb55c512e72aebd9b801ee429e8be6ea610f283::node:ec285c9771fc11aa9bbf7f2151ed079d

4.替换节点密码

在Server中运行

sudo cat /var/lib/rancher/k3s/server/cred/node-passwd

例如:

09de7171b260eae41f87815141ae5534,raspberrypi

在Agent中运行

sudo vi /var/lib/rancher/k3s/agent/node-password.txt

09de7171b260eae41f87815141ae5534【替换】掉原来的密码

5.查询节点状态
sudo k3s kubectl get all –all-namespaces -o wide


头像

小贱贱要飞

理想不只是成为一名程序猿,是成为一名编写人们生活每一步的艺术家!

0 条评论

发表评论

电子邮件地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据