Skip to content

Commit 37d69f7

Browse files
committed
Make network validation friendlier, especially to corp networks
1 parent fc8e032 commit 37d69f7

File tree

2 files changed

+82
-13
lines changed

2 files changed

+82
-13
lines changed

cmd/minikube/cmd/start.go

+9-11
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ func validateNetwork(h *host.Host, r command.Runner) string {
10011001
out.T(out.Option, "{{.key}}={{.value}}", out.V{"key": k, "value": v})
10021002
ipExcluded := proxy.IsIPExcluded(ip) // Skip warning if minikube ip is already in NO_PROXY
10031003
k = strings.ToUpper(k) // for http_proxy & https_proxy
1004-
if (k == "HTTP_PROXY" || k == "HTTPS_PROXY") && !ipExcluded && !warnedOnce {
1004+
if k == ("HTTP_PROXY" || k == "HTTPS_PROXY") && !ipExcluded && !warnedOnce {
10051005
out.WarningT("You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP ({{.ip_address}}). Please see {{.documentation_url}} for more details", out.V{"ip_address": ip, "documentation_url": "https://minikube.sigs.k8s.io/docs/reference/networking/proxy/"})
10061006
warnedOnce = true
10071007
}
@@ -1029,16 +1029,13 @@ Suggested workarounds:
10291029
defer conn.Close()
10301030
}
10311031

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

1036-
// Try both UDP and ICMP to assert basic external connectivity
1037-
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 {
1038-
out.WarningT("VM is unable to directly connect to the internet: {{.error}}", out.V{"error": err})
1039-
}
1040-
1041-
// Try an HTTPS connection to the
1038+
// Try an HTTPS connection to the image repository
10421039
proxy := os.Getenv("HTTPS_PROXY")
10431040
opts := []string{"-sS"}
10441041
if proxy != "" && !strings.HasPrefix(proxy, "localhost") && !strings.HasPrefix(proxy, "127.0") {
@@ -1051,8 +1048,9 @@ Suggested workarounds:
10511048
}
10521049

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

0 commit comments

Comments
 (0)