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