Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check connectivity outside minikube once it fails #18859

Merged
merged 7 commits into from
Jul 15, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions pkg/minikube/node/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os/exec"
"path"
"regexp"
"runtime"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -855,15 +856,39 @@ func tryRegistry(r command.Runner, driverName, imageRepository, ip string) {
imageRepository = images.DefaultKubernetesRepo
}
ComradeProgrammer marked this conversation as resolved.
Show resolved Hide resolved

opts = append(opts, fmt.Sprintf("https://%s/", imageRepository))
if rr, err := r.RunCmd(exec.Command("curl", opts...)); err != nil {
curlTarget := fmt.Sprintf("https://%s/", imageRepository)
opts = append(opts, curlTarget)
exe := "curl"
if runtime.GOOS == "windows" {
exe = "curl.exe"
}
cmd := exec.Command(exe, opts...)
if rr, err := r.RunCmd(cmd); err != nil {
klog.Warningf("%s failed: %v", rr.Args, err)
out.WarningT("This {{.type}} is having trouble accessing https://{{.repository}}", out.V{"repository": imageRepository, "type": driver.MachineType(driverName)})
out.ErrT(style.Tip, "To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/")

// using QEMU with the user network
if driver.IsQEMU(driverName) && ip == "127.0.0.1" {
out.WarningT("Due to DNS issues your cluster may have problems starting and you may not be able to pull images\nMore details available at: https://minikube.sigs.k8s.io/docs/drivers/qemu/#known-issues")
}
// now we shall also try whether this registry is reachable
// outside the machine so that we can tell in the logs that if
// the user's computer had any network issue or could it be
// related to a network module config change in minikube ISO

// We should skip the second check if the user is using the none
// or ssh driver since there is no difference between an "inside"
// and "outside" check on the none driver, and checking the host
// on the ssh driver is not helpful.
warning := "Failing to connect to {{.curlTarget}} from inside the minikube {{.type}}"
if !driver.IsNone(driverName) && !driver.IsSSH(driverName) {
if err := cmd.Run(); err != nil {
// both inside and outside failed
warning = "Failing to connect to {{.curlTarget}} from both inside the minikube {{.type}} and host machine"
}
}
out.WarningT(warning, out.V{"curlTarget": curlTarget, "type": driver.MachineType(driverName)})

out.ErrT(style.Tip, "To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/")
}
}

Expand Down
Loading