kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.08k stars 4.86k forks source link

VM has 50% resting CPU usage when idle #3207

Closed samuela closed 4 years ago

samuela commented 5 years ago

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Please provide the following details:

Environment: macOS 10.13.6

Minikube version (use minikube version): v0.29.0

What happened: I just installed and set up a fresh minikube cluster. CPU usage is pegged at ~50% even though no pods have been launched and nothing is happening on the cluster. I've observed the same behavior across both hyperkit and VirtualBox.

screen shot 2018-10-01 at 9 05 14 pm

I ran minikube addons enable heapster to get some insight into where all the CPU is going. It looks like kube-apiserver-minikube and kube-controller-manager-minikube are the primary offenders.

What you expected to happen: I expected the CPU usage to fall to basically zero when at rest. I understand that this may just be the baseline CPU usage for some of these services (liveness checks, etc). But when running in minikube mode, it'd really be nice to slow down the CPU consumption so that we don't kill all of our laptop batteries.

How to reproduce it (as minimally and precisely as possible): Create a minikube cluster on macOS with the appropriate versions.

Output of minikube logs (if applicable): n/a

Anything else do we need to know: n/a

sanarena commented 3 years ago

@priyawadhwa Thanks, updated but still having performance issue. Opened a new issue https://github.com/kubernetes/minikube/issues/9104 which got closed right after. seems like there is no solution anymore.

paneq commented 3 years ago

I went with microk8s or docker-for-mac, they don't have the high resting CPU usage.

@mitchej123 I tested docker-for-mac, minikube, microk8s, k3d and they all have the same issue. Some of them run as root and you need to use sudo [h]top instead of [h]top to see the effect, but they all suffer from the same problem.

bodhi-one commented 3 years ago

Was the issue actually resolved? Reports from various github sections including Docker for Mac and kubernetes itself is pointing to behavior of high polling into etcd as a root cause. The adjustments mentioned by priyawadhwa when closing the issue seem to be addressing what could be done in minikube. But core k8s issues seem to remain and are seen in various configurations/deployments.

https://github.com/kubernetes/kubernetes/issues/75565 https://github.com/docker/for-mac/issues/3065 https://github.com/kubernetes/kubernetes/issues/100415

mc0 commented 3 years ago

@talj-us-ibm-com At this point, I think the work referenced by @priyawadhwa does address most of the overhead that minikube can control (other adjustments that I brought up could cause things to be inconsistent longer). I had mentioned previously that a big portion of the overhead is https://github.com/kubernetes/kubernetes/issues/75565. (I had opened https://github.com/kubernetes/kubernetes/issues/89936 as a feature path towards addressing this in minikube.)

At the risk of being a bit ranty (and in reference to https://github.com/docker/for-mac/issues/3065), all of that is on top of Docker for Mac having disk performance issues (the recent gRPC FUSE changes help some), virtualization cpu performance issues, and a whole set of hoops that Docker has to jump through to make docker even run on a Mac.