• k8s问题解决


    问题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
  • 相关阅读:
    基于asp.net(C#)MVC+前端bootstrap+ztree+lodash+jquery技术-Angel工作室通用权限管理
    java架构之-负载均衡-Ribbon 的使用
    docker采用Dockerfile安装jdk1.8案例
    Redis 模糊查询删除操作
    centos7.2安装及管理docker
    git 解决每次更新代码都要输入用户名密码的解决方案
    github上的版本和本地版本冲突的解决方法
    git命令之git mergetool vi非正常退出.swp删除不了的问题
    html-webpack-plugin详解
    Webpack友好的错误提示插件friendly-errors-webpack-plugin
  • 原文地址:https://www.cnblogs.com/yangmeichong/p/16628270.html
Copyright © 2020-2023  润新知