环境准备

  • 192.168.2.4,192.168.2.5

image.png

安装步骤

  1. 执行安装脚本

    1. curl -sfL https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -

    image.png

    这台主机即是 k3s server 也是 k3s agent

  2. 加入节点

    token:在master节点查看

  1. curl -sfL https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https://centos02:6443 K3S_TOKEN=K10a973870b232bf2e3d8577ea9db1386df74fa248e4436321c6d8fccf0c3425b5b::server:83607eecf066f52d9c2e181ee9990f1d sh -
  1. 看下结果

image.png

卸载

  1. server卸载

    1. /usr/local/bin/k3s-uninstall.sh
  2. agent卸载

    1. /usr/local/bin/k3s-agent-uninstall.sh

参考文章