how to setup k3s on an offline ubuntu
Node└─ Pod└─ Container(s)
Deployment → manages pods
Service → exposes pods
Namespace → organizes all resources
download
k3s binaryhttps://github.com/k3s-io/k3s/releases/download/v1.34.1-rc1%2Bk3s1/k3s
airgap imagehttps://github.com/k3s-io/k3s/releases/download/v1.34.1-rc1%2Bk3s1/k3s-airgap-images-amd64.tar.gz
Start
./k3s server
./k3s ctr images import k3s-airgap-images-amd64.tar.gz
./k3s kubectl get nodes
./k3s kubectl get pods -A
Test
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=IfNotPresentdeploy as a standalone pod./k3s kubectl get pods./k3s kubectl expose pod my-nginx --type=NodePort --port=80Maybe need to ./k3s kubectl delete svc my-nginx
./k3s kubectl get svcNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEkubernetes ClusterIP 10.43.0.1 <none> 443/TCP 40mmy-nginx NodePort 10.43.84.143 <none> 80:31804/TCP 18scurl http://localhost:31804