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
相关推荐
YoungStudyAI7 小时前
QA的下一个自动化阶段,可能不是再写更多脚本,而是设计测试Agent
运维·自动化
阿钱真强道8 小时前
22 嵌入式操作系统 | 串口命令行调试(socat / stty / printf / hexdump)
ubuntu·cmake·uci·ubus·libubox
分布式存储与RustFS8 小时前
纠删码到底吃掉了多少容量:EC:4、EC:8 的利用率与容错怎么算
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
遇见小修修8 小时前
3步解决打印机0x00000709报错 ,广州深圳程序员可自行排查
运维·打印机·维修·打印机报错·打印机运维·打印机故障自查
顺顺 尼8 小时前
linux 进程信号(上)
linux·c++·算法
niuTaylor9 小时前
飞腾 FT-2000/4 Ubuntu 内存卡 / NVMe SSD 系统制作完整指南
linux·服务器·人工智能·驱动开发·单片机
傲世仙尊10 小时前
信号量环形队列与线程池起步-把临界资源拆成很多份
linux
Huangjin007_10 小时前
【Linux 系统篇(二十五)】文件(二) 系统文件I/O详解
linux·运维·服务器
微小冷11 小时前
Mermaid画甘特图
运维·markdown·甘特图·mermaid·时间图
ShineWinsu11 小时前
对于ProtoBuffer:ProtoBuffer的介绍以及安装
linux·网络·google·协议·序列化·反序列化·protobuffer