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
相关推荐
QMCY_jason5 分钟前
x86 ubuntu2204 无gui 安装 openeuler 2203 aarch64版本
linux·运维·服务器
重生之小比特9 分钟前
【Linux系统】12 进程程序替换 自定义Shell 命令行解释器
linux·运维·服务器
考拉讲支付12 分钟前
母婴亲子服务平台分账架构设计:多场景多方分账与合规清结算实践
大数据·运维·人工智能·微信小程序·架构·微信公众平台
LateFrames28 分钟前
“场控软件” 如何容错与运维
运维·容错·led大屏·播控系统·场控软件
Uncertainty!!28 分钟前
Windows 10 与 Ubuntu 22.04 通过 Samba 共享文件夹
windows·ubuntu·共享文件夹
あ-36 分钟前
CubeSandBox配置CubeMaster CPU 超分
linux·运维·服务器
Escalating_xu39 分钟前
【Linux 网络编程】TCP Socket 编程(上):从 listen、accept 到完整回显通信
linux·网络·tcp/ip
老秦包你会1 小时前
Linux第十课---------Linux信号
linux
艾伦_耶格宇1 小时前
【DOCKER容器实战】-5 Docker容器镜像的构建
运维·docker·容器
速捷工控 PLC触摸屏还原程序1 小时前
S7-200 SMART程序上传提示密码?维修、改造和换机怎么选处理路径?
运维·服务器