Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

K3s offline installation

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report