Skip to content

Commit

Permalink
Merge pull request #5802 from tstromberg/corp-friendly-network
Browse files Browse the repository at this point in the history
Make network validation friendlier, especially to corp networks
  • Loading branch information
tstromberg authored Oct 31, 2019
2 parents fc8e032 + 361222f commit 9b4534c
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 12 deletions.
18 changes: 8 additions & 10 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -1029,16 +1029,13 @@ Suggested workarounds:
defer conn.Close()
}

if _, err := r.RunCmd(exec.Command("nslookup", "kubernetes.io")); err != nil {
out.WarningT("VM is unable to resolve DNS hosts: {[.error}}", out.V{"error": err})
// DNS check
if rr, err := r.RunCmd(exec.Command("nslookup", "kubernetes.io")); err != nil {
glog.Warningf("%s failed: %v", rr.Args, err)
out.WarningT("VM may be unable to resolve external DNS records")
}

// Try both UDP and ICMP to assert basic external connectivity
if _, err := r.RunCmd(exec.Command("/bin/bash", "-c", "nslookup k8s.io 8.8.8.8 || nslookup k8s.io 1.1.1.1 || ping -c1 8.8.8.8")); err != nil {
out.WarningT("VM is unable to directly connect to the internet: {{.error}}", out.V{"error": err})
}

// Try an HTTPS connection to the
// Try an HTTPS connection to the image repository
proxy := os.Getenv("HTTPS_PROXY")
opts := []string{"-sS"}
if proxy != "" && !strings.HasPrefix(proxy, "localhost") && !strings.HasPrefix(proxy, "127.0") {
Expand All @@ -1051,8 +1048,9 @@ Suggested workarounds:
}

opts = append(opts, fmt.Sprintf("https://%s/", repo))
if _, err := r.RunCmd(exec.Command("curl", opts...)); err != nil {
out.WarningT("VM is unable to connect to the selected image repository: {{.error}}", out.V{"error": err})
if rr, err := r.RunCmd(exec.Command("curl", opts...)); err != nil {
glog.Warningf("%s failed: %v", rr.Args, err)
out.WarningT("VM is unable to access {{.repository}}, you may need to configure a proxy or set --image-repository", out.V{"repository": repo})
}
return ip
}
Expand Down
Loading

0 comments on commit 9b4534c

Please sign in to comment.