Get the App
SLTechnology News&Howtos  ›  Servers  › 

K3s offline installation

Shulou Source: shulou.com Published: 2022-06-02 09:26:13 10月04日 Update

The test environment kubernetes is a little bloated, and K3s is a good choice (mainly because there is no public network and the production environment is recommended to use kubernetes)

The default network used by K3s is fannel. If you need other network cni, please search the relevant documents yourself.

Deployment environment:

System: ubuntu 16.04

Component: docker-ce18.06 (please install it in advance. If it is not docker, K3s will provide containerd, but the operation is not as convenient as docker. Here we take docker as an example)

Download offline package (put it in the same directory)

1. All the container images

Https://github.com/rancher/k3s/releases/download/v1.17.0%2Bk3s.1/k3s-airgap-images-amd64.tar

two。 The main binary file k3s

Https://github.com/rancher/k3s/releases/download/v1.17.0%2Bk3s.1/k3s

3. Download the official install.sh

Https://github.com/rancher/k3s/blob/master/install.sh

II. Deployment

1. Deploy master

Mainly add parameters that skip image download:

Export INSTALL_K3S_SKIP_DOWNLOAD=true

Server script:

# / bin/bashset-esudo cp K3s / usr/local/bin/#use dockersudo docker load

< k3s-airgap-images-amd64.tar.gzif [ $(cat install.sh|grep "export INSTALL_K3S_SKIP_DOWNLOAD=true"|wc -l) -eq 0 ];then sudo sed -i 3i"export INSTALL_K3S_SKIP_DOWNLOAD=true" install.shfisudo bash install.sh#use dockerif [ $(cat /etc/systemd/system/k3s.service|grep server|grep docker|wc -l) -eq 0 ];then sudo sed -i 's?server?server --docker?g' /etc/systemd/system/k3s.servicefi sudo systemctl daemon-reloadsudo systemctl restart k3sbash create-client.sh docker 2.生成agent脚本,添加token到服务的文件中 模板脚本client-tmp-docker.sh: #!/bin/bashset -ecp -f k3s /usr/local/bin/K3S_TOKEN="TOKENK3S-SERVER"cat >

K3s-agent.service client-k3s.sh sed-I "s?TOKENK3S-SERVER?$K3S_TOKEN?g" client-k3s.sh sed-I "sailing SEVERKESIPPlayer $(hostname-I)? G" client-k3s.shfi

3. Deploy agent

Copy client.sh, K3s, k3s-airgap-images-amd64.tar, install.sh to the host where you need to deploy agent, and be sure to put them in the same directory

Execute cd / path & & bash client.sh

Verify after completion:

If you need more sex words, please refer to https://rancher.com/docs/k3s/latest/en/

Tags: Scripts environments files directories networks services generation good bloated personality hosts binaries parameters just official suggestions documents methods more templates Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Microsoft Huawei Xiaomi MariaDB