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

kic: Use bind IP for minikube IP on linux #7267

Closed
Closed
Show file tree
Hide file tree
Changes from 5 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
10 changes: 9 additions & 1 deletion cmd/minikube/cmd/docker-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,15 @@ var dockerEnvCmd = &cobra.Command{

var err error
port := constants.DockerDaemonPort
hostIP := co.DriverIP.String()
if driver.IsKIC(driverName) {
// Update host ip to bind iP
dockerIP := net.ParseIP(oci.DefaultBindIPV4)
if dockerIP == nil {
exit.WithCodeT(exit.Software, fmt.Sprintf("Unable to parse driver IP: %q", dockerIP))
}
hostIP = dockerIP.String()

port, err = oci.ForwardedPort(driverName, cname, port)
if err != nil {
exit.WithCodeT(exit.Failure, "Error getting port binding for '{{.driver_name}} driver: {{.error}}", out.V{"driver_name": driverName, "error": err})
Expand All @@ -161,7 +169,7 @@ var dockerEnvCmd = &cobra.Command{
EnvConfig: sh,
profile: cname,
driver: driverName,
hostIP: co.DriverIP.String(),
hostIP: hostIP,
port: port,
certsDir: localpath.MakeMiniPath("certs"),
noProxy: noProxy,
Expand Down
5 changes: 0 additions & 5 deletions pkg/minikube/mustload/mustload.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/kverify"
"k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config"
Expand Down Expand Up @@ -111,10 +110,6 @@ func Running(name string) ClusterController {
exit.WithError("Unable to get driver IP", err)
}

if driver.IsKIC(host.DriverName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not wrong, I believe we still need this for macOS.
we can not hit the IP of the container but the DefaultBind 127.0.0.1

ips = oci.DefaultBindIPV4
}

ip := net.ParseIP(ips)
if ip == nil {
exit.WithCodeT(exit.Software, fmt.Sprintf("Unable to parse driver IP: %q", ips))
Expand Down