当我运行sudo minikube start --vm-driver = none时,出现错误

时间:2019-11-01 06:16:15

标签: kubernetes minikube

当我运行sudo minikube start --vm-driver=none时,会出现此错误,并且我正在使用Ubuntu 16.0.4。

Error starting cluster: cmd failed: sudo env PATH=/var/lib/minikube/binaries/v1.16.2:$PATH kubeadm init --config /var/tmp/minikube/kubeadm.yaml  --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--var-lib-minikube,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap

: running command: sudo env PATH=/var/lib/minikube/binaries/v1.16.2:$PATH kubeadm init --config /var/tmp/minikube/kubeadm.yaml  --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--var-lib-minikube,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap
 output: [init] Using Kubernetes version: v1.16.2
[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 Swap]: running with swap on is not supported. Please disable swap
    [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: 19.03.4. Latest validated version: 18.09
    [WARNING Hostname]: hostname "minikube" could not be reached
    [WARNING Hostname]: hostname "minikube": lookup minikube on 127.0.1.1:53: no such host
    [WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
    [WARNING Port-10250]: Port 10250 is in use
error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR Port-10251]: Port 10251 is in use
    [ERROR Port-10252]: Port 10252 is in use
    [ERROR Port-2380]: Port 2380 is in use
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
: running command: sudo env PATH=/var/lib/minikube/binaries/v1.16.2:$PATH kubeadm init --config /var/tmp/minikube/kubeadm.yaml  --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--var-lib-minikube,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap
.: exit status 1

2 个答案:

答案 0 :(得分:1)

none驱动程序做出了许多假设,这些假设通常由所有其他驱动程序使用的VM设置过程来处理。在这种情况下,您可以看到它希望使用的某些端口已在使用中,因此不会继续。您将需要删除使用这些端口的任何内容。 none驱动程序通常用于非常特殊的情况,几乎总是在短暂的CI环境中使用,尽管也许还可以将KinD作为一种较新的工具来使用,它可能会更好地解决该用例。如果您只想在没有中间VM的Linux上运行本地开发环境,则可以尝试使用k3s或microk8s。

答案 1 :(得分:0)

documentation中,有关于需要释放这些端口的说明。您需要找出使用它们的方式来消除这些错误:

[WARNING Port-10250]: Port 10250 is in use
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR Port-10251]: Port 10251 is in use
[ERROR Port-10252]: Port 10252 is in use
[ERROR Port-2380]: Port 2380 is in use

这会阻止您加载系统,documentation中对此进行了说明。要进行调查,可以使用以下命令:

$ sudo lsof -i :10251

如果未安装此命令,则可以使用以下命令安装它:

$ sudo apt-get install lsof

可以使用--vm-driver=none运行minikube,但不建议这样做。通过不使用任何驱动程序,您将降低可靠性,降低安全性,丢失数据的风险等等。有关更多详细信息,请参见documentation

有一个解决这些安全问题的问题。

Full list of open ‘none’ driver issues

在Linux上最好的方法是使用kvm。为此,您可以按照以下说明进行操作(假设您拥有Docker CE installed):

$ sudo apt-get install -y qemu-kvm libvirt-clients libvirt-daemon-system
$ sudo adduser $USER libvirt

并使用kvm2驱动程序运行minikube:

$ minikube start --vm-driver kvm2 --kubernetes-version v1.15.0