Skip to content

Commit

Permalink
feat: check connectivity outside minikube once it fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ComradeProgrammer committed Jun 16, 2024
1 parent 7777113 commit bfc9828
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 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 @@ -856,14 +857,32 @@ func tryRegistry(r command.Runner, driverName, imageRepository, ip string) {
}

opts = append(opts, fmt.Sprintf("https://%s/", imageRepository))
if rr, err := r.RunCmd(exec.Command("curl", opts...)); err != nil {
exe := "curl"
if runtime.GOOS == "windows" {
exe = "curl.exe"
}
cmd := exec.Command(exe, opts...)
if rr, err := r.RunCmd(cmd); err != nil {
outside := true
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 minikbue ISO
if err := cmd.Run(); err != nil {
outside = false
}
if !outside {
// both inside and outside failed
out.WarningT("This {{.type}} is also having trouble accessing https://{{.repository}} both inside and outside the minikube ", out.V{"repository": imageRepository, "type": driver.MachineType(driverName)})
} else {
// only inside the minikube failed
out.WarningT("This {{.type}} is having trouble accessing https://{{.repository}} only inside the minikube", 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/")
}
}

Expand Down

0 comments on commit bfc9828

Please sign in to comment.