diff --git a/cmd/minikube/cmd/service.go b/cmd/minikube/cmd/service.go index 039afefc285d..f9e222d64971 100644 --- a/cmd/minikube/cmd/service.go +++ b/cmd/minikube/cmd/service.go @@ -34,6 +34,7 @@ import ( "k8s.io/minikube/pkg/drivers/kic/oci" "k8s.io/minikube/pkg/minikube/browser" + "k8s.io/minikube/pkg/minikube/driver" "k8s.io/minikube/pkg/minikube/exit" "k8s.io/minikube/pkg/minikube/localpath" "k8s.io/minikube/pkg/minikube/mustload" @@ -78,7 +79,7 @@ var serviceCmd = &cobra.Command{ cname := ClusterFlagValue() co := mustload.Healthy(cname) - if runtime.GOOS == "darwin" && co.Config.Driver == oci.Docker { + if driver.NeedsPortForward(co.Config.Driver) { startKicServiceTunnel(svc, cname) return } @@ -137,7 +138,7 @@ func startKicServiceTunnel(svc, configName string) { service.PrintServiceList(os.Stdout, data) openURLs(svc, urls) - out.WarningT("Because you are using docker driver on Mac, the terminal needs to be open to run it.") + out.WarningT("Because you are using a Docker driver on {{.operating_system}}, the terminal needs to be open to run it.", out.V{"operating_system": runtime.GOOS}) <-ctrlC diff --git a/cmd/minikube/cmd/tunnel.go b/cmd/minikube/cmd/tunnel.go index dbf66cf110b5..9edb8086c547 100644 --- a/cmd/minikube/cmd/tunnel.go +++ b/cmd/minikube/cmd/tunnel.go @@ -21,7 +21,6 @@ import ( "os" "os/signal" "path/filepath" - "runtime" "strconv" "time" @@ -30,6 +29,7 @@ import ( "k8s.io/minikube/pkg/drivers/kic/oci" "k8s.io/minikube/pkg/minikube/config" + "k8s.io/minikube/pkg/minikube/driver" "k8s.io/minikube/pkg/minikube/exit" "k8s.io/minikube/pkg/minikube/localpath" "k8s.io/minikube/pkg/minikube/mustload" @@ -78,7 +78,8 @@ var tunnelCmd = &cobra.Command{ cancel() }() - if runtime.GOOS == "darwin" && co.Config.Driver == oci.Docker { + if driver.NeedsPortForward(co.Config.Driver) { + port, err := oci.ForwardedPort(oci.Docker, cname, 22) if err != nil { exit.WithError("error getting ssh port", err)