Kubernetes Minikube - Invalid memory value assigned for 'minikube'

3/9/2020

Setting up Minikube on my Windows 10 Surface laptop and the cluster fails to create. Performed the following steps:

  • Installed all Hyper-V features
  • Created Hyper-V external switch
  • Installed Minikube using choco install minikube
  • Configured minikube using minikube config --driver=hyperv
  • Attempted to start minikube using minikube start --hyperv-virtual-switch=ExternalWifi

When attempting to start, minikube throws the following error:

PS C:\WINDOWS\system32> minikube start --driver=hyperv
* minikube v1.8.1 on Microsoft Windows 10 Enterprise 10.0.18363 Build 18363
* Using the hyperv driver based on user configuration
* Downloading VM boot image ...
* Creating hyperv VM (CPUs=2, Memory=4077MB, Disk=20000MB) ...
* Downloading preloaded images tarball for k8s v1.17.3 ...
> preloaded-images-k8s-v1-v1.17.3-docker-overlay2.tar.lz4: 280.46 MiB / 499E0309 09:38:58.605779   11932 main.go:106] libmachine: [stderr =====>] : Hyper-V\New-VM : Failed to modify device 'Memory'.
Invalid memory value assigned for 'minikube'. Memory values must be properly aligned.
'minikube' failed to modify device 'Memory'. (Virtual machine ID 06BCBFDB-C000-4BF4-97BF-D16008DAC326)
Invalid memory value assigned for 'minikube'. The memory value assigned ('4077' MB) is not properly aligned. Try again with a memory value that is properly aligned. (Virtual machine ID
06BCBFDB-C000-4BF4-97BF-D16008DAC326)
At line:1 char:1
+ Hyper-V\New-VM minikube -Path 'C:\Users\myuser\.minikube\machines\m ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.NewVM


    > preloaded-images-k8s-v1-v1.17.3-docker-overlay2.tar.lz4: 289.28 MiB / 499*
X Unable to start VM. Please investigate and run 'minikube delete' if possible: creating host: create: creating: exit status 1
-- phydeauxman
hyper-v
kubernetes
minikube
windows-10

1 Answer

3/9/2020

When attempting to manually create a VM using the same parameters that the minikube setup was attempting to use, I discovered that Hyper-V requires you to assign memory in 2 MB increments. Minikube was attempting to create a VM with 4077 MB of memory which was causing the failure. When I ran minikube setup with the command below, initialization completed successfully:

minikube start --driver=hyperv --memory=4078m

-- phydeauxman
Source: StackOverflow