diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index c4b415df4af5fc575cdba213ebf0473a14d41616..ffc7f36cc0a364144160c76a71f7dd4dafaaef84 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -985,7 +985,7 @@ func validateRequestedMemorySize(req int, drvName string) { } } -// validateCPUCount validates the cpu count matches the minimum recommended +// validateCPUCount validates the cpu count matches the minimum recommended & not exceeding the available cpu count func validateCPUCount(drvName string) { var cpuCount int if driver.BareMetal(drvName) { @@ -1019,6 +1019,22 @@ func validateCPUCount(drvName string) { } + if si.CPUs < cpuCount { + + if driver.IsDockerDesktop(drvName) { + out.Step(style.Empty, `- Ensure your {{.driver_name}} daemon has access to enough CPU/memory resources.`, out.V{"driver_name": drvName}) + if runtime.GOOS == "darwin" { + out.Step(style.Empty, `- Docs https://docs.docker.com/docker-for-mac/#resources`, out.V{"driver_name": drvName}) + } + if runtime.GOOS == "windows" { + out.String("\n\t") + out.Step(style.Empty, `- Docs https://docs.docker.com/docker-for-windows/#resources`, out.V{"driver_name": drvName}) + } + } + + exitIfNotForced(reason.RsrcInsufficientCores, "Requested cpu count {{.requested_cpus}} is greater than the available cpus of {{.avail_cpus}}", out.V{"requested_cpus": cpuCount, "avail_cpus": si.CPUs}) + } + // looks good if si.CPUs >= 2 { return