minUsableMem=1024// Kubernetes will not start with less than 1GB
minRecommendedMem=2000// Warn at no lower than existing configurations
minimumCPUS=2
minimumDiskSize="2000mb"
autoUpdate="auto-update-drivers"
...
...
@@ -149,8 +151,8 @@ func initMinikubeFlags() {
startCmd.Flags().Bool(interactive,true,"Allow user prompts for more information")
startCmd.Flags().Bool(dryRun,false,"dry-run mode. Validates configuration, but does not mutate system state")
startCmd.Flags().Int(cpus,2,"Number of CPUs allocated to the minikube VM.")
startCmd.Flags().String(memory,defaultMemorySize,"Amount of RAM allocated to the minikube VM (format: <number>[<unit>], where unit = b, k, m or g).")
startCmd.Flags().Int(cpus,2,"Number of CPUs allocated to Kubernetes.")
startCmd.Flags().String(memory,"","Amount of RAM to allocate to Kubernetes (format: <number>[<unit>], where unit = b, k, m or g).")
startCmd.Flags().String(humanReadableDiskSize,defaultDiskSize,"Disk size allocated to the minikube VM (format: <number>[<unit>], where unit = b, k, m or g).")
startCmd.Flags().Bool(downloadOnly,false,"If true, only download and cache files for later use - don't install or start anything.")
startCmd.Flags().Bool(cacheImages,true,"If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none.")
exit.WithCodeT(exit.Config,"Requested disk size {{.requested_size}} is less than minimum of {{.minimum_size}}",out.V{"requested_size":diskSizeMB,"minimum_size":pkgutil.CalculateSizeInMB(minimumDiskSize)})
// defaultMemorySize calculates the default memory footprint in MB
funcdefaultMemorySize(drvNamestring)int{
fallback:=2200
maximum:=6000
v,err:=mem.VirtualMemory()
iferr!=nil{
returnfallback
}
available:=v.Total/1024/1024
// For KIC, do not allocate more memory than the container has available (+ some slack)
ifdriver.IsKIC(drvName){
s,err:=oci.DaemonInfo(drvName)
iferr!=nil{
returnfallback
}
maximum=int(s.TotalMemory/1024/1024)-128
}
suggested:=int(available/4)
ifsuggested>maximum{
suggested=maximum
}
ifsuggested<fallback{
suggested=fallback
}
glog.Infof("Selecting memory default of %dMB, given %dMB available and %dMB maximum",suggested,available,maximum)
returnsuggested
}
// validateMemorySize validates the memory size matches the minimum recommended
exit.WithCodeT(exit.Config,"Requested memory allocation {{.requested_size}} is less than the minimum allowed of {{.minimum_size}}",out.V{"requested_size":memorySizeMB,"minimum_size":pkgutil.CalculateSizeInMB(minimumMemorySize)})
out.T(out.Notice,"Requested memory allocation ({{.memory}}MB) is less than the default memory allocation of {{.default_memorysize}}MB. Beware that minikube might not work correctly or crash unexpectedly.",
out.T(out.Notice,"Requested memory allocation ({{.requested}}MB) is less than the recommended minimum {{.recommended}}MB. Kubernetes may crash unexpectedly.",
exit.WithCodeT(exit.Config,"Requested disk size {{.requested_size}} is less than minimum of {{.minimum_size}}",out.V{"requested_size":diskSizeMB,"minimum_size":pkgutil.CalculateSizeInMB(minimumDiskSize)})
}
}
if!driver.HasResourceLimits(drvName){
ifcmd.Flags().Changed(cpus){
ifcmd.Flags().Changed(cpus){
validateCPUCount(driver.BareMetal(drvName))
if!driver.HasResourceLimits(drvName){
out.WarningT("The '{{.name}}' driver does not respect the --cpus flag",out.V{"name":drvName})
}
ifcmd.Flags().Changed(memory){
}
ifcmd.Flags().Changed(memory){
validateMemorySize()
if!driver.HasResourceLimits(drvName){
out.WarningT("The '{{.name}}' driver does not respect the --memory flag",out.V{"name":drvName})
exit.WithCodeT(exit.Config,`Error: You have selected Kubernetes v{{.new}}, but the existing cluster for your profile is running Kubernetes v{{.old}}. Non-destructive downgrades are not supported, but you can proceed by performing one of the following options:
* Recreate the cluster using Kubernetes v{{.new}}: Run "minikube delete {{.profile}}", then "minikube start {{.profile}} --kubernetes-version={{.new}}"
* Create a second cluster with Kubernetes v{{.new}}: Run "minikube start -p <new name> --kubernetes-version={{.new}}"
* Reuse the existing cluster with Kubernetes v{{.old}} or newer: Run "minikube start {{.profile}} --kubernetes-version={{.old}}"`,out.V{"new":nvs,"old":ovs,"profile":profileArg})
suggestedName:=old.Name+"2"
out.T(out.Conflict,"You have selected Kubernetes v{{.new}}, but the existing cluster is running Kubernetes v{{.old}}",out.V{"new":nvs,"old":ovs,"profile":profileArg})
exit.WithCodeT(exit.Config,`Non-destructive downgrades are not supported, but you can proceed with one of the following options:
1) Recreate the cluster with Kubernetes v{{.new}}, by running: