k8s 常用命令
https://blog.csdn.net/doublepg13/article/details/134537788 k8s重新生成证书
强制删除pod:
kubectl delete namespace my-namespace --force --grace-period=0
crictl ps
ctr -n k8s.io tasks ls
ctr -n k8s.io tasks kill 008296ad722d8cdcf2ec72e8c1d4948bf820c3a3dbae5d5dd13b4272f966a9df
ctr -n k8s.io containers ls
ctr -n k8s.io containers delete 008296ad722d8cdcf2ec72e8c1d4948bf820c3a3dbae5d5dd13b4272f966a9df
ctr 导入导出:
ctr -n k8s.io image export/import node.v3.27.2.tar docker.io/calico/node:v3.27.2
ctr -n k8s.io image export/import cni.v3.27.2.tar docker.io/calico/cni:v3.27.2
ctr -n k8s.io image export/import kube-controllers.v3.27.2.tar docker.io/calico/kube-controllers:v3.27.2
kubeadm token create --print-join-command #k8s 加入节点的命令
crictl image #查看container 镜像
kubectl get cs,csr,node,pods,svc --all-namespaces -o wide #查看node,pod等信息
kubectl describe pod relay-1-866d79c764-wcbrx -n closeli (kubectl describe pods -n kube-system) #描述显示特定资源或资源组的详细信息
kubectl delete pod/api-6c64d4b8bd-h7rkm -n closeli #pod删除后重新拉起
kubectl -n kube-system rollout restart deployments/podname #pod重启
kubectl apply -f coredns.yaml #启用1个pod
kubectl get pods -n kube-system #查看pod 运行状态
kubectl get csr # 查看证书请求
kubectl certificate approve node-csr-4zTjsaVSrhuyhIGqsefxzVoZDCNKei-aE2jyTP81Uro # 授权请求
kubectl get node #查看Node状态
kubectl exec -ti pod/nginx-relay-2-55b7856759-krxlg -n closeli -- /bin/sh #进入1个pod
进入docker容器 :
docker exec -ti <your-container-name> /bin/sh
进入pod:
kubectl exec -ti <your-pod-name> -n <your-namespace> -- /bin/sh
注:其他进入方式大致相通,只是具体细节有些区别。