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
相关推荐
nihui1236 分钟前
Kali Linux 中 Nmap 工具详细使用指南
linux·网络·web安全
生而为虫6 分钟前
34-35.玩转Linux操作系统
linux·运维·服务器
枕咸鱼的猫8 分钟前
Linux命令打包/压缩(tar)、通用压缩(zip)详解
linux·运维·服务器
`林中水滴`9 分钟前
Linux系列:Ubantu 安装 MySQL 8.0 教程
linux
你我一见如故13 分钟前
Linux基础(4)Linux中的开发工具(1)--yum和vim
linux·服务器·编辑器·vim
JiMoKuangXiangQu25 分钟前
Linux eBPF 错误:invalid bpf_context access
linux·ebpf
慧一居士31 分钟前
ubuntu和centos区别对比,使用方式区别对比及示例
运维
johnny_hhh33 分钟前
Confluent 单节点部署配置
运维·阿里云·zookeeper·kafka·centos·数据可视化
kaoa00037 分钟前
Linux入门攻坚——61、tomcat负载均衡集群-LB Cluster
linux·tomcat·负载均衡
洋葱 ☠37 分钟前
极简部署linux免费ssl证书Let‘s Encrypt,自动续签,nginx/apache都可以,域名指向服务器即可,无需项目
linux·nginx·ssl