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

How to deploy K3s offline

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

Share

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

What this article shares with you is a detailed tutorial on offline deployment of K3s. I believe most people do not know how to install and deploy. In order to let you learn, I have summarized the following content for you. Without saying much, let's move on.

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:

After reading this article, have you learned how to deploy K3s offline? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.

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: 219

*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