@@ -301,12 +301,7 @@ func runStart(cmd *cobra.Command, args []string) {
301
301
302
302
// No need to install a driver in download-only mode
303
303
if ! viper .GetBool (downloadOnly ) {
304
- v , err := version .GetSemverVersion ()
305
- if err != nil {
306
- out .WarningT ("Error parsing minikube version: {{.error}}" , out.V {"error" : err })
307
- } else if err := driver .InstallOrUpdate (driverName , localpath .MakeMiniPath ("bin" ), v , viper .GetBool (interactive ), viper .GetBool (autoUpdate )); err != nil {
308
- out .WarningT ("Unable to update {{.driver}} driver: {{.error}}" , out.V {"driver" : driverName , "error" : err })
309
- }
304
+ updateDriver (driverName )
310
305
}
311
306
312
307
k8sVersion , isUpgrade := getKubernetesVersion (oldConfig )
@@ -360,12 +355,7 @@ func runStart(cmd *cobra.Command, args []string) {
360
355
configureMounts ()
361
356
362
357
// enable addons with start command
363
- for _ , a := range addonList {
364
- err = cmdcfg .Set (a , "true" )
365
- if err != nil {
366
- exit .WithError ("addon enable failed" , err )
367
- }
368
- }
358
+ enableAddons ()
369
359
370
360
if err = loadCachedImagesInConfigFile (); err != nil {
371
361
out .T (out .FailureType , "Unable to load cached images from config file." )
@@ -375,7 +365,31 @@ func runStart(cmd *cobra.Command, args []string) {
375
365
if driverName == driver .None {
376
366
prepareNone ()
377
367
}
368
+ waitCluster (bs , config )
369
+ if err := showKubectlInfo (kubeconfig , k8sVersion ); err != nil {
370
+ glog .Errorf ("kubectl info: %v" , err )
371
+ }
372
+ }
373
+
374
+ func updateDriver (driverName string ) {
375
+ v , err := version .GetSemverVersion ()
376
+ if err != nil {
377
+ out .WarningT ("Error parsing minikube version: {{.error}}" , out.V {"error" : err })
378
+ } else if err := driver .InstallOrUpdate (driverName , localpath .MakeMiniPath ("bin" ), v , viper .GetBool (interactive ), viper .GetBool (autoUpdate )); err != nil {
379
+ out .WarningT ("Unable to update {{.driver}} driver: {{.error}}" , out.V {"driver" : driverName , "error" : err })
380
+ }
381
+ }
382
+
383
+ func enableAddons () {
384
+ for _ , a := range addonList {
385
+ err := cmdcfg .Set (a , "true" )
386
+ if err != nil {
387
+ exit .WithError ("addon enable failed" , err )
388
+ }
389
+ }
390
+ }
378
391
392
+ func waitCluster (bs bootstrapper.Bootstrapper , config cfg.Config ) {
379
393
var podsToWaitFor []string
380
394
381
395
if ! viper .GetBool (waitUntilHealthy ) {
@@ -385,9 +399,6 @@ func runStart(cmd *cobra.Command, args []string) {
385
399
if err := bs .WaitForPods (config .KubernetesConfig , viper .GetDuration (waitTimeout ), podsToWaitFor ); err != nil {
386
400
exit .WithError ("Wait failed" , err )
387
401
}
388
- if err := showKubectlInfo (kubeconfig , k8sVersion ); err != nil {
389
- glog .Errorf ("kubectl info: %v" , err )
390
- }
391
402
}
392
403
393
404
func displayVersion (version string ) {
@@ -1009,10 +1020,19 @@ func validateNetwork(h *host.Host, r command.Runner) string {
1009
1020
}
1010
1021
1011
1022
if ! driver .BareMetal (h .Driver .DriverName ()) {
1012
- sshAddr := fmt .Sprintf ("%s:22" , ip )
1013
- conn , err := net .Dial ("tcp" , sshAddr )
1014
- if err != nil {
1015
- exit .WithCodeT (exit .IO , `minikube is unable to connect to the VM: {{.error}}
1023
+ trySSH (h , ip )
1024
+ }
1025
+
1026
+ tryLookup (r )
1027
+ tryRegistry (r )
1028
+ return ip
1029
+ }
1030
+
1031
+ func trySSH (h * host.Host , ip string ) {
1032
+ sshAddr := fmt .Sprintf ("%s:22" , ip )
1033
+ conn , err := net .Dial ("tcp" , sshAddr )
1034
+ if err != nil {
1035
+ exit .WithCodeT (exit .IO , `minikube is unable to connect to the VM: {{.error}}
1016
1036
1017
1037
This is likely due to one of two reasons:
1018
1038
@@ -1025,16 +1045,19 @@ Suggested workarounds:
1025
1045
- Configure your local VPN or firewall to allow access to {{.ip}}
1026
1046
- Restart or reinstall {{.hypervisor}}
1027
1047
- Use an alternative --vm-driver` , out.V {"error" : err , "hypervisor" : h .Driver .DriverName (), "ip" : ip })
1028
- }
1029
- defer conn .Close ()
1030
1048
}
1049
+ defer conn .Close ()
1050
+ }
1031
1051
1052
+ func tryLookup (r command.Runner ) {
1032
1053
// DNS check
1033
1054
if rr , err := r .RunCmd (exec .Command ("nslookup" , "kubernetes.io" )); err != nil {
1034
1055
glog .Warningf ("%s failed: %v" , rr .Args , err )
1035
1056
out .WarningT ("VM may be unable to resolve external DNS records" )
1036
1057
}
1058
+ }
1037
1059
1060
+ func tryRegistry (r command.Runner ) {
1038
1061
// Try an HTTPS connection to the image repository
1039
1062
proxy := os .Getenv ("HTTPS_PROXY" )
1040
1063
opts := []string {"-sS" }
@@ -1052,7 +1075,6 @@ Suggested workarounds:
1052
1075
glog .Warningf ("%s failed: %v" , rr .Args , err )
1053
1076
out .WarningT ("VM is unable to access {{.repository}}, you may need to configure a proxy or set --image-repository" , out.V {"repository" : repo })
1054
1077
}
1055
- return ip
1056
1078
}
1057
1079
1058
1080
// getKubernetesVersion ensures that the requested version is reasonable
0 commit comments