mv k0s-v1.23.8+k0s.0-amd64 /usr/local/bin/k0s
chmod 755 -- /usr/local/bin/k0s
k0s install controller
systemctl start k0scontroller
systemctl status k0scontroller
k0s token create --role=worker --expiry=100h > token-file
将 token 文件复制到 worker 主机上
scp token-file 192.168.110.36:/root/
scp token-file 192.168.110.37:/root/
worker上执行:
k0s install worker --token-file /root/token-file
systemctl start k0sworker
systemctl restart k0sworker
systemctl status k0sworker
---------------------------------------------------------------------------------------------------
k0s kubectl get nodes
k0s kubectl delete node node6
#查看全部结果
k0s kubectl get all --all-namespaces
k0s kubectl get pods -n kube-system
k0s kubectl get pod -o wide -n kube-system
k0s kubectl delete pod coredns-5f9c56787d-cdbmk -n kube-system #删除一个pod
k0s kubectl describe pod coredns-5f9c56787d-kkxhv -n kube-system #查看详细
k0s kubectl logs ngx-php -c init-myservice #查看日志
k0s kubectl get deployment -n kube-system
k0s kubectl describe deployment coredns -n kube-system
k0s kubectl describe deployment metrics-server -n kube-system
k0s kubectl get deploy --all-namespace
k0s kubectl get deploy -n kube-system
修改镜像
k8s.gcr.io/coredns/coredns:v1.7.0
,"imagePullPolicy":"Always"
k0s kubectl patch deployment coredns --patch '{"spec": {"template": {"spec": {"containers": [{"name": "coredns","image":"registry.aliyuncs.com/google_containers/coredns:v1.7.0"}]}}}}' -n kube-system
k0s kubectl get svc
k0s kubectl get namespace
k0s kubectl get cs
重启pod:
没有yaml文件生成yaml文件
k0s kubectl get pods -n kube-system
k0s kubectl get pod pod名称 -n 命名空间名称 -o yaml | kubectl replace —force -f -
k0s kubectl get pod coredns-8565977d9b-kp55r -n kube-system -o yaml | k0s kubectl replace --force -f -
镜像无法摘取处理方法
How To Reproduce
1 In a local area network environment
2 Installed private harbor repository with self-signed. push pause:3.2 to harbor.
3 /etc/hosts
192.168.1.10 k8s.gcr.io
4 podman pull k8s.gcr.io/pause:3.2
docker push k8s.gcr.io/pause:3.5
#新的方法
https://blog.csdn.net/u010674101/article/details/118019955
docker pull registry.aliyuncs.com/google_containers/pause:3.5
docker tag registry.aliyuncs.com/google_containers/pause:3.5 k8s.gcr.io/pause:3.5
docker save k8s.gcr.io/pause >pause.tar
ctr -n k8s.io image import pause.tar