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
相关推荐
春日见8 分钟前
如何跑通,吃透一个开源项目?
linux·运维·开发语言·数码相机·matlab
Blueeyedboy5219 分钟前
服务器监控工具-netdata
运维·服务器
hkNaruto14 分钟前
【docker】docker exec -it 报错 open /dev/pts/0: operation not permitted
运维·docker·容器
TG:@yunlaoda360 云老大16 分钟前
华为云国际站代理商DSS的跨区域备份与恢复具体是如何实现的?
运维·服务器·华为云
Ccjf酷儿22 分钟前
计算机网络 (郑烇) 2 应用层
运维·服务器·计算机网络
寰天柚子26 分钟前
服务器性能优化实战:从资源瓶颈定位到极致调优(附租赁服务器适配指南)
运维·服务器·udp
用户61354114601626 分钟前
【麒麟Kylin】cmake-3.16.5 rpm包安装步骤详解 附常见问题
linux
AAA_bo127 分钟前
liunx安装canda、python、nodejs、git,随后部署私有网页内容提取工具--JinaReader全攻略
linux·python·ubuntu·typescript·aigc·python3.11·jina
未来之窗软件服务31 分钟前
服务器运维(十九)web服务管理Nginx UI介绍——东方仙盟炼气期
运维·服务器·服务器运维·东方仙盟
梦想的旅途235 分钟前
企业微信外部群消息自动化:模拟操作与工程化实现路径探讨
运维·服务器