how to setup k3s on an offline ubuntu

bash 复制代码
Node
 └─ Pod
      └─ Container(s)
Deployment → manages pods
Service → exposes pods
Namespace → organizes all resources

download

bash 复制代码
k3s binary
	https://github.com/k3s-io/k3s/releases/download/v1.34.1-rc1%2Bk3s1/k3s
airgap image
	https://github.com/k3s-io/k3s/releases/download/v1.34.1-rc1%2Bk3s1/k3s-airgap-images-amd64.tar.gz

Start

bash 复制代码
./k3s server 
./k3s ctr images import k3s-airgap-images-amd64.tar.gz
./k3s kubectl get nodes
./k3s kubectl get pods -A

Test

bash 复制代码
docker pull nginx:latest
docker save -o nginx.tar nginx:latest

./k3s ctr images import nginx.tar
./k3s ctr images list  | grep nginx
./k3s ctr images tag docker.io/library/nginx:latest nginx:latest
	
./k3s kubectl create deployment my-nginx --image=nginx:latest 
	Error because always pulling image from internet

./k3s kubectl run my-nginx --image=nginx:latest --image-pull-policy=IfNotPresent
	deploy as a standalone pod

./k3s kubectl get pods

./k3s kubectl expose pod my-nginx --type=NodePort --port=80
	Maybe need to ./k3s kubectl delete svc my-nginx
./k3s kubectl get svc
	NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
	kubernetes   ClusterIP   10.43.0.1      <none>        443/TCP        40m
	my-nginx     NodePort    10.43.84.143   <none>        80:31804/TCP   18s

	
curl http://localhost:31804
相关推荐
志栋智能11 分钟前
超自动化巡检剧本(Playbook):运维经验的数字化封装
运维·自动化
ElevenS_it18822 分钟前
Nginx日志监控告警实战:access_log解析+5xx突增+慢请求+异常IP自动告警完整方案(Filebeat+Zabbix)
运维·网络·tcp/ip·nginx·zabbix
weixin_3077791323 分钟前
Python写入Shell文件使用Linux系统的换行符
linux·开发语言·python·自动化
liulilittle1 小时前
Linux Swap 文件配置与持久化(虚拟内存)
linux·运维·服务器
未若君雅裁1 小时前
日志采集与ELK:从本地日志到集中检索分析
运维·elk·jenkins
青梅橘子皮1 小时前
Linux---进程控制(2)(进程程序替换)
linux·c++·算法
零陵上将军_xdr1 小时前
从沙子到CPU——计算机硬件基础入门
linux·运维·硬件架构
vortex51 小时前
Linux 命令工具箱:util-linux 与 GNU Coreutils
linux·运维·gnu
AIex-YH1 小时前
三域贯通11/12:生物制造的“死亡之谷“,CDMO 是桥还是船?
运维·制造·策略模式
荒--1 小时前
MSF 使用
linux·运维·服务器