Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperv: Default to disabling dynamic memory (--hyperv-disable-dynamic-memory to driver) #1766

Closed
DenisBiondic opened this issue Jul 28, 2017 · 17 comments
Labels
co/hyperv HyperV related issues good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. r/2019q2 Issue was last reviewed 2019q2
Milestone

Comments

@DenisBiondic
Copy link
Contributor

Is this a BUG REPORT or FEATURE REQUEST?
Feature Request

Minikube version v0.20.0

Environment:

  • OS Windows 10
  • VM Driver Hyper-V

Couple of issues already point out to problem with Hyper-V and dynamic memory:
1252 & 1762

Would it not be better to start the Hyper-V machine with dynamic memory turned off? Currently this switch in not given in to Powershell configuration, but it would be a simple thing to do:
-DynamicMemoryEnabled $true --- check here: https://technet.microsoft.com/en-us/itpro/powershell/windows/hyper-v/set-vmmemory

I would be happy to send a pull request for this.

@DenisBiondic DenisBiondic changed the title Feature: Hyper-V should start with Dynamic Memory off? Feature request - Hyper-V should start with Dynamic Memory off? Jul 28, 2017
@r2d4 r2d4 added kind/feature Categorizes issue or PR as related to a new feature. co/hyperv HyperV related issues labels Jul 28, 2017
@aaron-prindle
Copy link
Contributor

@DenisBiondic Having dynamic memory turned off or at least making it configurable would definitely help resolve some issues we are seeing with the Hyper-V driver. That would be great if you could send PR for this, thanks!

@DenisBiondic
Copy link
Contributor Author

@aaron-prindle will try to do it in the next few days

@whereisaaron
Copy link

The problem I was that the default setting for dynamic memory is the uncapped maximum amount. Over a couple days Hyper-V would suck up 20GB+ of RAM in to 'Driver Locker' even though the minicube was only using less than 2MB. Setting a sensible max amount for dynamic memory fixed that for me. (Windows 10 version 1703). I guess turning it off is the alternative fix!

@DenisBiondic
Copy link
Contributor Author

@aaron-prindle could you give me some pointers for where the relevant code for configuring powershell flags for Hyper V is? I never did anything in Go, I will try to go through some tutorials in the meantime to try to understand the structure better...

@msnelling
Copy link
Contributor

@DenisBiondic While the VM is stopped (or before it's started you can use the following PowerShell command to set the dynamic memory flag.

$VM | Set-VMMemory -DynamicMemoryEnabled $false

or

Set-VMMemory -VMName 'minikube' -DynamicMemoryEnabled $false

https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmmemory?view=win10-ps

@JockDaRock
Copy link

I am not sure I consider this as a feature and more of a bug fix. You cannot currently use Hyper-V without disabling Dynamic Memory. That seems like a bug to me.

That being said the Docker-For-Windows Hyper-V VM disables Dynamic Memory when it is booted. Seems that minikube should follow suit and do the same thing

@Disturbing
Copy link

Agreed on this - Bumping for now!

@shahiddev
Copy link
Contributor

Hello everyone,
I've been bitten by this so many times (mostly just before a demo) that I decided to take a look at this.

I'm not very experienced in Go but I think I've implemented the changes, however rather embarrassingly not sure how to build this on a Windows machine.
Any pointers ?

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 26, 2018
@whereisaaron
Copy link

/remove-lifecycle stale

I think this is wrongly labeled as a feature request. I think it bug and AFAIK not fixed?

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 26, 2018
@shahiddev
Copy link
Contributor

The required changes were made to upstream Docker Machine but not yet wired up to Minikube, there has been some questions around what the team want to do with the docker machine dependency otherwise I'm ready to implement

@m1o1
Copy link

m1o1 commented Oct 12, 2018

I disabled DynamicMemory with this change:

diff --git a/pkg/minikube/drivers/hyperv/driver.go b/pkg/minikube/drivers/hyperv/driver.go
index 2323b6383..7b2843a0e 100644
--- a/pkg/minikube/drivers/hyperv/driver.go
+++ b/pkg/minikube/drivers/hyperv/driver.go
@@ -45,6 +45,7 @@ func createHypervHost(config cfg.MachineConfig) interface{} {
 	d.MemSize = config.Memory
 	d.CPU = config.CPUs
 	d.DiskSize = int(config.DiskSize)
+	d.DisableDynamicMemory = true
 	d.SSHUser = "docker"
 
 	return d

Then I recompiled with this (using Git Bash on Windows)

MSYS_NO_PATHCONV=1 docker run --rm -v "$(pwd)":/go/src/k8s.io/minikube -w /go/src/k8s.io/minikube golang:stretch make cross

Edit* For some reason, I would get this warning while building:

WARNING: You are building minikube outside the expected GOPATH

But if I start bash instead, then run the make command from inside, that doesn't happen:

$ MSYS_NO_PATHCONV=1 docker run -it --rm -v "$(pwd)":/go/src/k8s.io/minikube -w /go/src/k8s.io/minikube golang:stretch /bin/bash
root@d7305eb27c46:/go/src/k8s.io/minikube# make cross
GOPATH=/go ./makedepend.sh out/docker-machine-driver-kvm2 k8s.io ./cmd/drivers/kvm/  > out/docker-machine-driver-kvm2.d
...
out/minikube-windows-amd64 k8s.io/minikube/cmd/minikube
cp out/minikube-windows-amd64 out/minikube-windows-amd64.exe

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 10, 2019
@baltiyskiy
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 11, 2019
@tstromberg tstromberg added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. labels Jan 24, 2019
@tstromberg tstromberg changed the title Feature request - Hyper-V should start with Dynamic Memory off? hyperv: Default to disabling dynamic memory (--hyperv-disable-dynamic-memory to driver) Jan 24, 2019
@tstromberg
Copy link
Contributor

I'd never heard of dynamic memory before, but read up a little on it:

https://blogs.technet.microsoft.com/virtualization/2015/05/26/when-to-use-hyper-v-dynamic-memory-versus-runtime-memory-resize/

I don't know much about HyperV, but I would definitely be happy to help someone implement this if they want to tackle it. It seems like the --hyperv-disable-dynamic-memory option is supported already by the hyperv driver:

https://docs.docker.com/machine/drivers/hyper-v/#4-create-the-nodes-with-docker-machine-and-the-microsoft-hyper-v-driver

Does someone mind taking this on?

@tstromberg tstromberg added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jan 24, 2019
@xarses
Copy link

xarses commented Mar 14, 2019

specifically hammering Set-VMMemory -VMName 'minikube' -DynamicMemoryEnabled $false is what is needed while the minikube vm is creating, if you manage it before it starts, I get about 5 seconds that It can be run, it seems to go great.

@tstromberg tstromberg added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Apr 4, 2019
@tstromberg tstromberg added this to the v1.2.0-candidate milestone May 22, 2019
@tstromberg tstromberg added the r/2019q2 Issue was last reviewed 2019q2 label May 22, 2019
@tstromberg
Copy link
Contributor

This is now fixed at head, and will be part of the next minikube release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/hyperv HyperV related issues good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. r/2019q2 Issue was last reviewed 2019q2
Projects
None yet
Development

No branches or pull requests