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
相关推荐
二进制coder2 小时前
深入解析 AST2600 H2B 接口:架构、原理与完整开发指南
linux·架构
HeXDev3 小时前
【Docker】一键将运行中的容器打包成镜像并导出
运维·docker·容器
狐小粟同学3 小时前
JavaEE--8.网络编程
运维·服务器·网络
sainty073 小时前
linux 宏 DEVICE_ATTR
linux
ajassi20003 小时前
linux C 语言开发 (六) 程序的编辑和编译(vim、gcc)
linux·运维·服务器
Murphy_lx3 小时前
vim指令
linux·编辑器·vim
小猪写代码3 小时前
vim 编辑器
linux·编辑器·vim
nmxiaocui3 小时前
Linux vi/vim
linux·运维·vim
XJxsmyj523 小时前
vim复制本地到linux服务器上,换行缩进过大,不对的问题
linux·编辑器·vim