zoukankan      html  css  js  c++  java
  • k8s报错解决思路

    问题1

    1.报错信息如下

    [root@ken1 ~]# kubectl get po
    The connection to the server 192.168.64.11:6443 was refused - did you specify the right host or port?
    

    解决思路:

    1.首先检查kubelet以及dockers是否启动

    2.检查交换分区是否关闭

    本机是因为交换分区没有关闭造成的,在/etc/fstab文件中禁用重启系统即可

    [root@ken1 ~]# free -h
                  total        used        free      shared  buff/cache   available
    Mem:           1.8G        188M        1.0G        8.6M        593M        1.4G
    Swap:          2.0G          0B        2.0G
    [root@ken1 ~]# vim /etc/fstab 
    [root@ken1 ~]# cat /etc/fstab 
    
    #
    # /etc/fstab
    # Created by anaconda on Wed Aug 14 15:30:02 2019
    #
    # Accessible filesystems, by reference, are maintained under '/dev/disk'
    # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
    #
    /dev/mapper/cl-root     /                       xfs     defaults        0 0
    UUID=5ab6cfa4-d753-4d73-b3d6-ebf408b58b56 /boot                   xfs     defaults        0 0
    #/dev/mapper/cl-swap     swap                    swap    defaults        0 0
    

    再次查看,问题解决

    [root@ken1 ~]# kubectl get no
    NAME   STATUS   ROLES    AGE     VERSION
    ken1   Ready    master   3d15h   v1.15.2
    ken2   Ready    <none>   3d15h   v1.15.2
    ken3   Ready    <none>   3d15h   v1.15.2
    

    ==============================================================================

    问题2

    节点加入集群中报如下的错误

    [root@ken2 ~]# kubeadm join 192.168.232.199:6443 --token 5fsbj7.3iobmze5ow8jcz4w     --discovery-token-ca-cert-hash sha256:c17bcdcf9b65fef975527d3b02d9cc22621b77916a974a35b112fc5639cb4e77
    [preflight] Running pre-flight checks
            [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
            [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.1. Latest validated version: 18.09
    [preflight] Reading configuration from the cluster...
    [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
    [kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.15" ConfigMap in the kube-system namespace
    [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
    [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
    [kubelet-start] Activating the kubelet service
    [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
    [kubelet-check] Initial timeout of 40s passed.
    error execution phase kubelet-start: error uploading crisocket: timed out waiting for the condition

    解决办法

    在从节点执行如下的命令

    [root@ken2 ~]# kubeadm reset
    [reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.
    [reset] Are you sure you want to proceed? [y/N]: y
    [preflight] Running pre-flight checks
    W0820 16:03:33.400935   56927 removeetcdmember.go:79] [reset] No kubeadm config, using etcd pod spec to get data directory
    [reset] No etcd config found. Assuming external etcd
    [reset] Please, manually reset etcd to prevent further issues
    [reset] Stopping the kubelet service
    [reset] Unmounting mounted directories in "/var/lib/kubelet"
    [reset] Deleting contents of config directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
    [reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
    [reset] Deleting contents of stateful directories: [/var/lib/kubelet /etc/cni/net.d /var/lib/dockershim /var/run/kubernetes]
    The reset process does not reset or clean up iptables rules or IPVS tables.
    If you wish to reset iptables, you must do so manually.
    For example:
    iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X
    
    If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
    to reset your system's IPVS tables.
    
    The reset process does not clean your kubeconfig files and you must remove them manually.
    Please, check the contents of the $HOME/.kube/config file.

    然后根据提示执行下面的命令

    [root@ken2 ~]# iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X

    再次加入即可成功

    ======================================================================

    Continue Reading

  • 相关阅读:
    python模块—socket
    mac os系统的快捷键
    教你如何将UIImageView视图中的图片变成圆角
    关于ASP.NET MVC
    iOS 日期格式的转换
    将App通过XCode上传到AppStore 出现这个错误“An error occurred uploading to the iTunes Store”的解决方法
    关于MAC OS下面两个软件的功能改进——Dictionary和Fit 输入法
    分享一下上个星期的香港行程
    【博客园IT新闻】博客园IT新闻 iPhone 客户端发布
    解决Entity Framework Code First 的问题——Model compatibility cannot be checked because the database does not contain model metadata
  • 原文地址:https://www.cnblogs.com/it-peng/p/11393812.html
Copyright © 2011-2022 走看看