Flow the instrustration of Rancher k3s documentation
For some reasons, the k3s installation package and installation script should be downloaded first according to the document.
curl -sfL https://github.com/rancher/k3s/releases/download/vX.Y.Z/k3s -o /usr/local/bin/k3s
chmod 0755 /usr/local/bin/k3s
curl -sfL https://get.k3s.io -o install-k3s.sh
chmod 0755 install-k3s.sh
export INSTALL_K3S_SKIP_DOWNLOAD=true
–cluster-cidr and –service-cidr must set before the K3s Server start
Be careful if CIDR is not specified here, it cannot be modified after starting according to the existing issue.
export INSTALL_K3S_EXEC
= “–no-traifik –no-flannel –cluster-cidr 172.18.0.0/16 –service-cidr 172.19.0.0/16”
Download offline installation package
K3s supports offline installation of several main components, which can be downloaded directly from GitHub library at https://github.com/rancher/k3s/releases:
sudo mkdir -p /var/lib/rancher/k3s/agent/images/
sudo cp ./k3s-airgap-images-$ARCH.tar /var/lib/rancher/k3s/agent/images/
this tar file included images is the basic package used when starting k3s.
Execute the installation script. Note that by default, k3s does not use docker to manage images, but uses CTR management.
. / install-k3s.sh
k3s ctr images ls
Master node installation completed
Install the work node and download the offline package according to the above steps. Here, you need to token and set the address of the primary node.
cat /var/lib/rancher/k3s/server/node-token
export K3S_URL=https://myserver:6443
export K3S_TOKEN=XXX
. / install-k3s. Sh
A simple k3s cluster has been builtup.
Reference: https://github.com/rancher/k3s