« Back to home

Minikube on Windows stops responding

This is a quick post to try and help anyone else who runs into an issue with Minikube on Windows suddenly not responding to commands. The solution is actually quite straightforward and in fact in the documentation (I did RTFM and had previously recreated the hyper-v switch which solved the issue for a little while)

TL;DR

Jump straight to the solution below

Minikube is a fantastic tool for trying out Kubernetes without needing to have a full blown cluster at your disposable.
I talk about and use Minikube as part of a talk I give around Kubernetes and recently I've run into an issue where Minikube stops responding. As you can imagine this is a real issue when you are trying to demo something in front a bunch of people who've given up their evenings to listen to you talk.
Luckily I've been able to fall back to the amazing Katacoda site when this does happen, however I still wanted to get it resolved.

Problem

Minikube starts up fine and will respond as you expect, however if you leave it alone for some period of time - in my case the time it takes to talk through a few more slides (10-15mins) it may stop responding. Sometimes just restarting the cluster may fix the issue but I've had occasions where I've had to brute force delete the whole cluster and set it up again.

This screenshot below captures it perfectly, I spun a number of pods and left it for about 10mins and then trying to run the same command again resulted in an error

Solution

It turns out if you've already tried recreating the switch and still run into the problem then the culprit may well be the dynamic memory management.
To solve this:

  1. Stop the minikube cluster if its still running which you can usually do with minikube stop
  2. Open the memory settings of the minikube vm (in Hyper-V manager, right click the vm and select settings > memory).
  3. Disable the dynamic memory setting and set the memory size you want to use

The default cluster created by Minikube (0.24.1) has this setting enabled so you have to go and disable it if you create a new cluster.
With these settings applied I didn't encounter the issue again even leaving the cluster running for a few hours.
Credit for the fix is in the documentation

Update (2018-06-19): I have a PR to disable the memory setting merged into the latest 0.15 Docker Machine version but in the meantime you can also the following powershell command to change the memory setting before starting minikube
Set-VMMemory minikube -DynamicMemoryEnabled