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
相关推荐
Johny_Zhao11 小时前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
chlk1232 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑2 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
碳基沙盒2 天前
OpenClaw 多 Agent 配置实战指南
运维
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash3 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI3 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行4 天前
Linux和window共享文件夹
linux
木心月转码ing4 天前
WSL+Cpp开发环境配置
linux