Minikube: Disable swap within minikube VM

Created on 24 Jul 2018  路  9Comments  路  Source: kubernetes/minikube

FEATURE REQUEST

I tried to debug, why minikube is slow for all our team. What I noticed, that minikube has swapiness = 60, this means, it will use swap if it has < 60% memory left. Most host OS already have swapiness set (60 for linux). Currenly if minikube uses >800Mb memory or host OS has <40% memory free, it goes to swap. Host OS is not part of minikube project, but minikube OS is

Doing swapoff or setting swapiness to 10 makes minikube much faster

Please provide the following details:

Environment:

Minikube version 0.28.0 (use minikube version):

  • OS (e.g. from /etc/os-release):
NAME="Ubuntu"
VERSION="18.04 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName):
    kvm2
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION):
        "Boot2DockerURL": "file:///home/kostenko/.minikube/cache/iso/minikube-v0.28.0.iso",
        "ISO": "/home/kostenko/.minikube/machines/minikube/boot2docker.iso",
  • Install tools:
  • Others:

What happened:
Minikube is extremely slow for our team (freezes whole UI)

What you expected to happen:

Make it not to freeze UI

How to reproduce it (as minimally and precisely as possible):

Run minikube with 72% memory usage. Then run htop/iotop on both host andVM

Output of minikube logs (if applicable):

Anything else do we need to know:

areguest-vm help wanted kinfeature prioritimportant-soon

Most helpful comment

swapoff makes sense to me. k8s has issues with swap in general.

All 9 comments

swapoff makes sense to me. k8s has issues with swap in general.

Swapoff will help as well

Was discussed in #1827, before the bot closed it

++
Whenever i start a minikube, what I always need to do is

minikube start
minikube ssh
sudo swapoff -a

This issue seems like an easy win, so I'm testing a possible PR to address it: #3278.

Upstream Kubernetes doesn't even officially support swap. I'm kinda surprised this was ever enabled.

It was a requirement of Docker (for a while), and Minikube was based on Docker Machine...

Removing the swap partition will potentially also make the machine disk image a lot smaller...

For some drivers (KVM), formatting the 1000M swap partition (mkswap) increases the image too.
Even though the space is mostly zero, you will have to do a img "compact" operation to reclaim it.

The virtualbox driver seems to do slightly better, and recognizes the the sparse file storage ?

Was this page helpful?
0 / 5 - 0 ratings