代码之家  ›  专栏  ›  技术社区  ›  E235

Minikube上没有可用的节点

  •  0
  • E235  · 技术社区  · 5 年前

    我正在一个vmware(Ubuntu 16.04)中开发minikube。
    几周来一切都很好。

    有一天我来了,发现我所有的豆荚都卡住了。
    describe 其中一个吊舱和锯子:

    没有节点可用于计划pods

    我卸载了Minikube:

    minikube stop; minikube delete &&
    docker stop $(docker ps -aq) &&
    rm -rf ~/.kube ~/.minikube &&
    rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
    rm -rf /etc/kubernetes/ &&
    docker system prune -af --volumes
    systemctl stop kubelet  
    systemctl disable kubelet
    

    重新安装:

    curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && mv minikube /usr/local/bin/  
    
    swapoff -a
    minikube start --vm-driver=none
    mv /root/.minikube $HOME/.minikube # this will write over any previous configuration
    chown -R $USER $HOME/.minikube
    chgrp -R $USER $HOME/.minikube
    

    当我奔跑 kubectl get nodes I received: 与服务器192.168.21.129:8443的连接被拒绝-您指定了正确的主机或端口吗?`

    我跑 docker ps -a :

    CONTAINER ID        IMAGE                  COMMAND                  CREATED              STATUS                      PORTS               NAMES
    602e5d1a27c1        3193be46e0b3           "kube-scheduler --ad…"   About a minute ago   Exited (2) 22 seconds ago                       k8s_kube-scheduler_kube-scheduler-minikube_kube-system_9729a196c4723b60ab401eaff722982d_1
    29208eeb5f46        k8s.gcr.io/pause:3.1   "/pause"                 2 minutes ago        Exited (0) 22 seconds ago                       k8s_POD_kube-scheduler-minikube_kube-system_9729a196c4723b60ab401eaff722982d_0
    

    我只有两个豆荚退出…
    这里发生了什么?
    我尽我所能(或不)把它卸载得很深。.

    如何进行故障排除和修复?

    编辑:
    我卸载了Minikube,但现在也删除了 kubelet 这样的服务:
    我按照指示把服务从 here :

    systemctl stop kubelet  
    systemctl disable kubelet  
    rm -rf /etc/systemd/system/kubelet.service.d
    rm -rf /lib/systemd/system/kubelet.service
    rm -rf /var/lib/kubelet
    rm -rf /usr/libexec/kubernetes/kubelet-plugins
    rm -rf /usr/bin/kubelet
    systemctl daemon-reload
    systemctl reset-failed  
    

    我搜索了一下,看看我的系统中是否还有 find / | grep kubelet 在下面找到了很多文件 /sys/kernel/slab . 我重新启动了机器,它就不见了。

    我重新安装了Minikube,一开始我收到了关于Kubelet的错误:

    sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests --ignore-preflight-errors=DirAvailable--data-minikube --ignore-preflight-errors=Port-10250 --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-etcd.yaml --ignore-preflight-errors=Swap --ignore-preflight-errors=CRI 
    
     output: [init] Using Kubernetes version: v1.13.2
    [preflight] Running pre-flight checks
        [WARNING FileExisting-ebtables]: ebtables not found in system path
        [WARNING FileExisting-socat]: socat not found in system path
        [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 18.02.0-ce. Latest validated version: 18.06
        [WARNING Hostname]: hostname "minikube" could not be reached
        [WARNING Hostname]: hostname "minikube": lookup minikube on 127.0.1.1:53: server misbehaving
    [preflight] Pulling images required for setting up a Kubernetes cluster
    [preflight] This might take a minute or two, depending on the speed of your internet connection
    [preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
    [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
    [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
    [kubelet-start] Activating the kubelet service
    [certs] Using certificateDir folder "/var/lib/minikube/certs/"
    [certs] Generating "etcd/ca" certificate and key
    [certs] Generating "etcd/server" certificate and key
    [certs] etcd/server serving cert is signed for DNS names [minikube localhost] and IPs [192.168.21.129 127.0.0.1 ::1]
    [certs] Generating "etcd/peer" certificate and key
    [certs] etcd/peer serving cert is signed for DNS names [minikube localhost] and IPs [192.168.21.129 127.0.0.1 ::1]
    [certs] Generating "etcd/healthcheck-client" certificate and key
    [certs] Generating "apiserver-etcd-client" certificate and key
    [certs] Generating "front-proxy-ca" certificate and key
    [certs] Generating "front-proxy-client" certificate and key
    [certs] Using existing ca certificate authority
    [certs] Using existing apiserver certificate and key on disk
    [certs] Generating "apiserver-kubelet-client" certificate and key
    [certs] Generating "sa" key and public key
    [kubeconfig] Using kubeconfig folder "/etc/kubernetes"
    [kubeconfig] Writing "admin.conf" kubeconfig file
    [kubeconfig] Writing "kubelet.conf" kubeconfig file
    [kubeconfig] Writing "controller-manager.conf" kubeconfig file
    [kubeconfig] Writing "scheduler.conf" kubeconfig file
    [control-plane] Using manifest folder "/etc/kubernetes/manifests"
    [control-plane] Creating static Pod manifest for "kube-apiserver"
    [control-plane] Creating static Pod manifest for "kube-controller-manager"
    [control-plane] Creating static Pod manifest for "kube-scheduler"
    [etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
    [wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
    [kubelet-check] Initial timeout of 40s passed.
    
    Unfortunately, an error has occurred:
        timed out waiting for the condition
    
    This error is likely caused by:
        - The kubelet is not running
        - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
    
    If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
        - 'systemctl status kubelet'
        - 'journalctl -xeu kubelet'
    
    Additionally, a control plane component may have crashed or exited when started by the container runtime.
    To troubleshoot, list all containers using your preferred container runtimes CLI, e.g. docker.
    Here is one example how you may list all Kubernetes containers running in docker:
        - 'docker ps -a | grep kube | grep -v pause'
        Once you have found the failing container, you can inspect its logs with:
        - 'docker logs CONTAINERID'
    error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster
    : running command: 
    sudo /usr/bin/kubeadm init --config /var/lib/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests --ignore-preflight-errors=DirAvailable--data-minikube --ignore-preflight-errors=Port-10250 --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-etcd.yaml --ignore-preflight-errors=Swap --ignore-preflight-errors=CRI 
    

    我试图再次启动它,然后它写道它成功了,但再次,所有的容器都被删除了。
    我认为它与Kubelet有关,但我把它拆了,然后重新安装了。

    1 回复  |  直到 5 年前
        1
  •  0
  •   E235    5 年前

    其中一个错误是:

    [警告系统验证]:此Docker版本不在列表中 验证版本:18.02.0-CE。最新验证版本:18.06

    我决定把Docker也搬走。

    这是我执行的完整卸载过程:

    # Remove minikube
    minikube stop; minikube delete &&
    docker stop $(docker ps -aq) &&
    rm -rf ~/.kube ~/.minikube &&
    rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
    rm -rf /etc/kubernetes/ &&
    docker system prune -af --volumes
    # remove kubelet
    systemctl stop kubelet  
    systemctl disable kubelet
    rm -rf /etc/systemd/system/kubelet.service.d
    rm -rf /lib/systemd/system/kubelet.service
    rm -rf /var/lib/kubelet
    rm -rf /usr/libexec/kubernetes/kubelet-plugins
    rm -rf /usr/bin/kubelet
    systemctl daemon-reload
    systemctl reset-failed  
    # uninstall docker
    dpkg -l | grep -i docker
    apt-get purge -y docker.io
    rm -rf /var/lib/docker
    apt-get autoremove -y --purge docker.io
    apt-get autoclean
    # remove other pieces
    rm -rf /home/myuser/.minikube
    rm -rf ~/.kube
    rm -f /var/lib/dpkg/info/kubelet*
    rm -f /var/cache/apt/archives/kubelet_1.13.2-00_amd64.deb
    rm -f /var/lib/systemd/deb-systemd-helper-enabled/kubelet.service.dsh-also
    rm -f /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/kubelet.service
    rm -f /etc/default/kubelet
    

    我重新启动机器并安装所有设备:

    apt-get install -y docker.io 
    curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && mv minikube /usr/local/bin/  
    swapoff -a
    minikube start --v=3 --vm-driver=none  
    

    现在一切正常。