Search code examples
dockerkubernetesdocker-machineminikube

Minikube hangs on the "Starting VM" step


Hi yet once again my beloved community.

My v0.33.1 minikube hangs on the "Starting VM..." step. I am using Windows 10 and a HyperV vm underneath. I am running my cluster with the following command:

minikube start --kubernetes-version="v1.10.11" --memory 4096 --vm-driver hyperv --hyperv-virtual-switch "HyperV Switch"

and my Docker is:

Version 2.0.0.3 (31259)
Channel: stable
Build: 8858db3

The VM underneath goes up but its CPU eventually falls down to 0% usage and it just stalls. Kubectl hangs as well.

I have already tried:

  1. Clearing out the Minikube cache under users/.../.minikube
  2. Minikube Delete
  3. Reinstall Minikube and Kubernetes CLI
  4. Reinstall Docker
  5. Meddling with the VM on the HyperV Host

Solution

  • Following the suggestion from Diego Mendes in the comment I investigated the issue causing the minikube machine to get IPv6 addressation which would cause it to hang on startup.

    I disabled IPv6 on the Virtual Network Switch (this can be done from the Network and Sharing Center -> Adapter Settings -> Right Click relevant Switch and just find the relevant checkbox) but the VM would regardless fetch an IPv6 address.

    Since v18.02 or later, Docker for Windows comes with an embedded Kubernetes cluster, this meddles with the minikube config causing it to choke having 2 clusters. The solution that fit my requirements was switching from using minikube to just using the internal native docker k8s cluster (The only major drawback is that you cannot specify k8s version but overall it makes the scripts simpler).

    You will have to run:

    • minikube delete

    Then change the kubernetes cluster context to point to the docker instance:

    • kubectl config use-context docker-for-desktop

    And now you should be able to do all the operations you would normally do with kubectl.