K3S离线安装

    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

    本博客所有文章如无特别注明均为原创。
    复制或转载请以超链接形式注明转自Who am I ?,原文地址《K3S离线安装
    喜欢 | 0
    分享:

还没有人抢沙发呢~