在此之前不需要部署k3s server 也不需要部署containerd。

部署格式

curl -sfL https://docs.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https://主节点IP地址:6443  K3S_TOKEN=主节点的token sh -

k3s-agent安装

由于 rancher.cn 域名正在备案中,因此使用默认的 https://rancher-mirror.rancher.cn/k3s/k3s-install.sh 地址部署集群会出现部署失败情况。如果发生此类问题,请使用以下方式解决: --k3s-install-script=https://rancher-mirror.rancher.cn/k3s/k3s-install.sh。

curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https://82.157.x.x:6443 K3S_TOKEN=K10192ce0e3f266497668f66e246add907b9ae929bca43f0a27090b9a43b63a0de4::server:2ee707e3ecd1bf2d6c3d59ad6ad77b5b sh -
[INFO]  Finding release for channel stable
[INFO]  Using v1.29.5+k3s1 as release
[INFO]  Downloading hash rancher-mirror.rancher.cn/k3s/v1.29.5-k3s1/sha256sum-amd64.txt
[INFO]  Downloading binary rancher-mirror.rancher.cn/k3s/v1.29.5-k3s1/k3s
[INFO]  Verifying binary download
[INFO]  Installing k3s to /usr/local/bin/k3s
[INFO]  Finding available k3s-selinux versions
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel                                                                                                      | 4.3 kB  00:00:00
extras                                                                                                    | 2.9 kB  00:00:00
os                                                                                                        | 3.6 kB  00:00:00
updates                                                                                                   | 2.9 kB  00:00:00
updates/7/x86_64/primary_db    FAILED

http://mirrors.tencentyun.com/centos/7/updates/x86_64/repodata/873e3f4ba7e1f50ba189c86efb1630c800da1efaeb20bbbcbd240390ad9214b5-primary.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use https://bugs.centos.org/
(1/3): epel/7/x86_64/updateinfo                                                                           | 1.0 MB  00:00:00

(2/3): epel/7/x86_64/primary_db                                                                           | 8.7 MB  00:00:00

Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
Loaded plugins: fastestmirror, langpacks
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
rancher-k3s-common-stable                                                                                 | 2.9 kB  00:00:00

rancher-k3s-common-stable/primary_db                                                                      | 4.6 kB  00:00:01

Resolving Dependencies
--> Running transaction check
---> Package k3s-selinux.noarch 0:1.5-1.el7 will be installed
--> Finished Dependency ResolutionDependencies Resolved
=================================================================================================================================
Package                     Arch                   Version                      Repository                                 Size
=================================================================================================================================
Installing:
k3s-selinux                 noarch                 1.5-1.el7                    rancher-k3s-common-stable                  16 k
Transaction Summary
=================================================================================================================================
Install  1 Package
Total download size: 16 k
Installed size: 94 k
Downloading packages:
warning: /var/cache/yum/x86_64/7/rancher-k3s-common-stable/packages/k3s-selinux-1.5-1.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID e257814a: NOKEY
Public key for k3s-selinux-1.5-1.el7.noarch.rpm is not installed
k3s-selinux-1.5-1.el7.noarch.rpm                                                                          |  16 kB  00:00:01

Retrieving key from https://rpm.rancher.io/public.key
Importing GPG key 0xE257814A:
Userid     : "Rancher (CI) <ci@rancher.com>"
Fingerprint: c8cf f216 4551 26e9 b9c9 18be 925e a29a e257 814a
From       : https://rpm.rancher.io/public.key
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : k3s-selinux-1.5-1.el7.noarch                                                                                  1/1
Verifying  : k3s-selinux-1.5-1.el7.noarch                                                                                  1/1Installed:
k3s-selinux.noarch 0:1.5-1.el7
Complete!
[INFO]  Skipping /usr/local/bin/kubectl symlink to k3s, command exists in PATH at /usr/bin/kubectl
[INFO]  Skipping /usr/local/bin/crictl symlink to k3s, command exists in PATH at /usr/bin/crictl
[INFO]  Skipping /usr/local/bin/ctr symlink to k3s, command exists in PATH at /usr/bin/ctr
[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 from /etc/systemd/system/multi-user.target.wants/k3s-agent.service to /etc/systemd/system/k3s-agent.service.
[INFO]  systemd: Starting k3s-agent