问题1:
问题描述:k8s中Terminating状态pod不能删除
[root@master ~]# kubectl get pods -n ms
NAME READY STATUS RESTARTS AGE
portal-7895774cd7-vr5wg 0/1 Terminating 1 102m
解决方法:强制删除
[root@master ~]# kubectl delete pods portal-7895774cd7-vr5wg --grace-period=0 --force -n ms
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "portal-7895774cd7-vr5wg" force deleted
问题2:
问题描述:k8s删除节点
[root@master k8s]# kubectl drain harbor --delete-local-data --force --ignore-daemonsets Flag --delete-local-data has been deprecated, This option is deprecated and will be deleted. Use --delete-emptydir-data. node/harbor cordoned WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-8z2sz, kube-system/kube-proxy-64ljc evicting pod ms/eureka-1 pod/eureka-1 evicted node/harbor evicted [root@master k8s]# kubectl get nodes NAME STATUS ROLES AGE VERSION harbor Ready,SchedulingDisabled <none> 44m v1.20.7 [root@master k8s]# kubectl delete node harbor node "harbor" deleted
# 被删除节点执行
kubeadm reset
问题3:
问题描述:k8s控制节点提示:The connection to the server 192.168.10.10:6443 was refused - did you specify the right host or port?
[root@master ~]# kubectl get nodes The connection to the server 192.168.10.10:6443 was refused - did you specify the right host or port? 造成原因: 1.有可能是刚改的配置问题导致 2.还有可能是服务器重启了导致 解决方法: 1.查看docker和kubelet服务是否有启动 systemctl status kubelet 2.查看kubelet日志 journalctl -xefu kubelet 我这边有很多次都是重启后出现这种情况,日志里说是The container name...is already in use by container...You have to remove (or rename) that container to be able to reuse that name. 处理方法: docker ps -a | grep 报错容器名字 删除已经 Exited的docker docker rm CONTAINER ID