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

Minikube on Windows 10 using Hyper-V not respecting memory allocation set in profile. #7144

Closed
DotNet-Ninja opened this issue Mar 22, 2020 · 6 comments
Labels
kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@DotNet-Ninja
Copy link

I've been running a set of PowerShell scripts (in various forms) to install and configure Minikube since mid November (starting with ~v1.5.1 if I remember correctly). The gist of the current scripts is there is one to install Minikube using the Chocolatey package and one to configure Minikube and start it up. Last night I began an exercise to clean up the scripts and retest them at which time I noticed that the setting for memory did not seem to be getting applied as expected.

Knowing that this had been working for the previous few months, I went back and verified I had not changed anything that was causing the issue and not seeing anything I looked at the recent release notes to see what had been changed and if possibly the API for setting this was changed. In reviewing the release notes I found that there was a reference to a PR (#6900) that if I understand correctly the intent was to set the memory to 1/4 of the available memory up to 6GB, but never less than 2GB by default (I assume by default means if memory size is not specified?). Interestingly 6GB is exactly what I am seeing allocated even though I'm requesting 8GB (I have 32GB of RAM).

Here is the configuration script I'm using on a clean (brand new install) of Minikube. (In between installs I'm uninstalling Minikube, removing the VM, and deleting the ~.minikube folder on my machine.)

minikube config set vm-driver hyperv 
minikube config set hyperv-virtual-switch "Default Switch" 
minikube config set memory 8192 
minikube config set cpus 8 
minikube config set disk-size 20g 
minikube start

minikube addons enable dashboard
minikube addons enable ingress

kubectl -n kubernetes-dashboard wait --for=condition=ready pods --all --timeout=120s

After running that command on the latest version here is my config:

{
    "cpus": 8,
    "disk-size": "20g",
    "hyperv-virtual-switch": "Default Switch",
    "memory": 8192,
    "vm-driver": "hyperv"
}

and here is the result of Get-VM on my machine:

❯ Get-VM
Name            State   CPUUsage(%) MemoryAssigned(M) Uptime           Status             Version
----            -----   ----------- ----------------- ------           ------             -------
DockerDesktopVM Running 0           2048              15:49:54.3130000 Operating normally 9.0
minikube        Running 0           6000              00:21:49.4050000 Operating normally 9.0

I've run my process 3 times this morning since finding the release notes and PR and have verified that this is new to v1.8.2. Below is a copy of the output from running my configuration script all three times:

Minikube Version 1.7.3

* Using the hyperv driver based on user configuration
* Downloading VM boot image ...
    > minikube-v1.7.3.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    > minikube-v1.7.3.iso: 167.39 MiB / 167.39 MiB [] 100.00% 17.38 MiB p/s 10s
* Creating hyperv VM (CPUs=8, Memory=8192MB, Disk=20000MB) ...
* Preparing Kubernetes v1.17.3 on Docker 19.03.6 ...
* Downloading kubelet v1.17.3
* Downloading kubeadm v1.17.3
* Downloading kubectl v1.17.3
* Launching Kubernetes ...
* Enabling addons: default-storageclass, storage-provisioner
* Waiting for cluster to come online ...
* Done! kubectl is now configured to use "minikube"
* The 'dashboard' addon is enabled
* The 'ingress' addon is enabled
pod/dashboard-metrics-scraper-7b64584c5c-5bznh condition met
pod/kubernetes-dashboard-79d9cd965-tbjbr condition met
❯ Get-VM

Name            State   CPUUsage(%) MemoryAssigned(M) Uptime           Status             Version
----            -----   ----------- ----------------- ------           ------             -------
DockerDesktopVM Running 0           2048              13:08:28.0500000 Operating normally 9.0
minikube        Running 0           8192              00:04:09.7540000 Operating normally 9.0

Minikube Version 1.8.1


* Using the hyperv driver based on user configuration
* Downloading VM boot image ...
    > minikube-v1.8.0.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    > minikube-v1.8.0.iso: 173.56 MiB / 173.56 MiB [] 100.00% 13.28 MiB p/s 14s
* Creating hyperv VM (CPUs=8, Memory=8192MB, Disk=20000MB) ...
* Downloading preloaded images tarball for k8s v1.17.3 ...
    > preloaded-images-k8s-v1-v1.17.3-docker-overlay2.tar.lz4: 499.26 MiB / 499
E0322 07:16:26.081220   14472 config.go:71] Failed to preload container runtime Docker: copying file: sudo test -d \ && sudo scp -t \ && sudo touch -d "2020-03-22 07:16:25.0064867 -0500" \/preloaded.tar.lz4: Process exited with status 1
output: , falling back to caching images
* Preparing Kubernetes v1.17.3 on Docker 19.03.6 ...
    > kubectl.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubelet.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubeadm.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s
    > kubeadm: 37.52 MiB / 37.52 MiB [----------------] 100.00% 5.29 MiB p/s 7s
    > kubectl: 41.48 MiB / 41.48 MiB [----------------] 100.00% 5.07 MiB p/s 8s
    > kubelet: 106.42 MiB / 106.42 MiB [-------------] 100.00% 7.64 MiB p/s 14s
* Launching Kubernetes ...
* Enabling addons: default-storageclass, storage-provisioner
* Waiting for cluster to come online ...
* Done! kubectl is now configured to use "minikube"
* The 'dashboard' addon is enabled
* The 'ingress' addon is enabled
pod/dashboard-metrics-scraper-7b64584c5c-kk9d4 condition met
pod/kubernetes-dashboard-79d9cd965-kwzh7 condition met
❯ Get-VM

Name            State   CPUUsage(%) MemoryAssigned(M) Uptime           Status             Version
----            -----   ----------- ----------------- ------           ------             -------
DockerDesktopVM Running 0           2048              13:15:56.7970000 Operating normally 9.0
minikube        Running 0           8192              00:03:04.1810000 Operating normally 9.0

Minikube version 1.8.2

* Using the hyperv driver based on user configuration
* Downloading VM boot image ...
    > minikube-v1.8.0.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    > minikube-v1.8.0.iso: 173.56 MiB / 173.56 MiB [] 100.00% 13.26 MiB p/s 13s
* Downloading preloaded images tarball for k8s v1.17.3 ...
    > preloaded-images-k8s-v1-v1.17.3-docker-overlay2.tar.lz4: 499.26 MiB / 499
* Creating hyperv VM (CPUs=8, Memory=6000MB, Disk=20000MB) ...
* Preparing Kubernetes v1.17.3 on Docker 19.03.6 ...
* Launching Kubernetes ...
* Enabling addons: default-storageclass, storage-provisioner
* Waiting for cluster to come online ...
* Done! kubectl is now configured to use "minikube"
* The 'dashboard' addon is enabled
* The 'ingress' addon is enabled
pod/dashboard-metrics-scraper-7b64584c5c-sgxwr condition met
pod/kubernetes-dashboard-79d9cd965-kzmlx condition met
❯ Get-VM

Name            State   CPUUsage(%) MemoryAssigned(M) Uptime           Status             Version
----            -----   ----------- ----------------- ------           ------             -------
DockerDesktopVM Running 0           2048              15:18:31.6990000 Operating normally 9.0
minikube        Running 0           6000              00:02:13.0730000 Operating normally 9.0

I also tried stopping and restarting Minikube after the configuration script has run to see if that would cause it to pick up the allocated memory and it did not.

I'm wondering if there is an unintentional "bug" causing it to only allocate 6GB in this scenario or if this was by design? If by design, how would I go about allocating more memory?

The exact command to reproduce the issue:

minikube config set vm-driver hyperv 
minikube config set hyperv-virtual-switch "Default Switch" 
minikube config set memory 8192 
minikube config set cpus 8 
minikube config set disk-size 20g 
minikube start

The full output of the command that failed:

* Using the hyperv driver based on user configuration
* Downloading VM boot image ...
    > minikube-v1.8.0.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    > minikube-v1.8.0.iso: 173.56 MiB / 173.56 MiB [] 100.00% 13.26 MiB p/s 13s
* Downloading preloaded images tarball for k8s v1.17.3 ...
    > preloaded-images-k8s-v1-v1.17.3-docker-overlay2.tar.lz4: 499.26 MiB / 499
* Creating hyperv VM (CPUs=8, Memory=6000MB, Disk=20000MB) ...
* Preparing Kubernetes v1.17.3 on Docker 19.03.6 ...
* Launching Kubernetes ...
* Enabling addons: default-storageclass, storage-provisioner
* Waiting for cluster to come online ...
* Done! kubectl is now configured to use "minikube"

The output of the minikube logs command:


minikube.v1.8.2.logs.txt

I'm also attaching my script files I used.
ConfigureMinikube.zip

The operating system version:
Window 10 Professional Version 1909 build 18363.720

@Larswa
Copy link

Larswa commented Mar 23, 2020

Yup ... seeing the same thing. Came in here to report the same bug. Same setup as original reporter.

@priyawadhwa priyawadhwa added kind/bug Categorizes issue or PR as related to a bug. kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it. and removed kind/bug Categorizes issue or PR as related to a bug. labels Mar 25, 2020
@priyawadhwa
Copy link

Hey @DotNet-Ninja @Larswa -- I merged #7082 which should fix this bug. It was released in v1.9.0-beta.1

Would you mind upgrading to any version of minikube >= v1.9.0-beta.1 and seeing if that resolves this issue?

@Larswa
Copy link

Larswa commented Mar 25, 2020

Hi @priyawadhwa I can confirm that works. Thanks!

@priyawadhwa
Copy link

Great, I'll go ahead and close this issue then.

@DotNet-Ninja
Copy link
Author

I can also confirm that does seem to fix the issue. Thanks!

* Using the hyperv driver based on user configuration
* Downloading VM boot image ...
    > minikube-v1.9.0-beta.1.iso.sha256: 65 B / 65 B [-------] 100.00% ? p/s 0s
    > minikube-v1.9.0-beta.1.iso: 173.57 MiB / 173.57 MiB  100.00% 13.21 MiB p/
* Downloading preloaded images tarball for k8s v1.18.0-rc.1 ...
    > preloaded-images-k8s-v2-v1.18.0-rc.1-docker-overlay2-amd64.tar.lz4: 542.8
* Creating hyperv VM (CPUs=8, Memory=8192MB, Disk=20000MB) ...
* Preparing Kubernetes v1.18.0-rc.1 on Docker 19.03.8 ...
* Launching Kubernetes ...
* Enabling addons: default-storageclass, storage-provisioner
* Waiting for cluster to come online ...
* Done! kubectl is now configured to use "minikube"
* The 'dashboard' addon is enabled
* The 'ingress' addon is enabled
pod/dashboard-metrics-scraper-84bfdf55ff-kdzfj condition met
pod/kubernetes-dashboard-bc446cc64-shdm2 condition met
❯ Get-VM

Name            State   CPUUsage(%) MemoryAssigned(M) Uptime             Status             Version
----            -----   ----------- ----------------- ------             ------             -------
DockerDesktopVM Running 0           2048              4.05:11:22.8900000 Operating normally 9.0
LinuxMint       Off     0           0                 00:00:00           Operating normally 9.0
minikube        Running 0           8192              00:01:48.3780000   Operating normally 9.0

@dipodidae
Copy link

This problem still occurs in minikube 1.12.3. I've downgraded to 1.12.0 which seems to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

4 participants