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

Auto select network on QEMU #15266

Merged
merged 3 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all 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: 23 additions & 10 deletions cmd/minikube/cmd/start_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,31 @@ func getNetwork(driverName string) string {
if !driver.IsQEMU(driverName) {
return n
}
if n == "" {
if runtime.GOOS == "darwin" {
out.WarningT("The default network for QEMU will change from 'user' to 'socket_vmnet' in a future release")
switch n {
case "socket_vmnet":
if runtime.GOOS != "darwin" {
exit.Message(reason.Usage, "The socket_vmnet network is only supported on macOS")
}
if !detect.SocketVMNetInstalled() {
exit.Message(reason.NotFoundSocketVMNet, "\n\n")
}
case "":
if detect.SocketVMNetInstalled() {
n = "socket_vmnet"
} else {
n = "user"
}
n = "user"
out.Styled(style.Internet, "Automatically selected the {{.network}} network", out.V{"network": n})
case "user":
default:
exit.Message(reason.Usage, "--network with QEMU must be 'user' or 'socket_vmnet'")
}
if n == "user" && runtime.GOOS == "darwin" {
out.WarningT("You are using the QEMU driver without a dedicated network, which doesn't support `minikube service` & `minikube tunnel` commands.\nTo try the experimental dedicated network see: https://minikube.sigs.k8s.io/docs/drivers/qemu/#networking")
if n == "user" {
msg := "You are using the QEMU driver without a dedicated network, which doesn't support `minikube service` & `minikube tunnel` commands."
if runtime.GOOS == "darwin" {
msg += "\nTo try the experimental dedicated network see: https://minikube.sigs.k8s.io/docs/drivers/qemu/#networking"
}
out.WarningT(msg)
}
return n
}
Expand All @@ -489,10 +506,6 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, rtime str
out.WarningT("--network flag is only valid with the docker/podman, KVM and Qemu drivers, it will be ignored")
}

if driver.IsQEMU(drvName) && viper.GetString(network) == "socket_vmnet" {
out.WarningT("Using qemu with 'socket_vmnet' network is experimental")
}

checkNumaCount(k8sVersion)

checkExtraDiskOptions(cmd, drvName)
Expand Down
18 changes: 18 additions & 0 deletions pkg/minikube/detect/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package detect

import (
"errors"
"net/http"
"os"
"os/exec"
Expand All @@ -25,7 +26,9 @@ import (
"strings"

"github.com/klauspost/cpuid"
"github.com/spf13/viper"
"golang.org/x/sys/cpu"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/localpath"
)

Expand Down Expand Up @@ -129,3 +132,18 @@ func KICCacheDir() string {
func ISOCacheDir() string {
return filepath.Join(localpath.MakeMiniPath("cache", "iso"), runtime.GOARCH)
}

// SocketVMNetInstalled returns if socket_vmnet is installed
func SocketVMNetInstalled() bool {
if runtime.GOOS != "darwin" {
return false
}
_, err := os.Stat(viper.GetString("socket-vmnet-path"))
if err == nil {
return true
}
if !errors.Is(err, os.ErrNotExist) {
klog.Warningf("failed to check for socket_vmnet: %v", err)
}
return false
}
14 changes: 14 additions & 0 deletions pkg/minikube/reason/reason.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,18 @@ var (
https://docs.docker.com/engine/install/`),
Style: style.Docker,
}
NotFoundSocketVMNet = Kind{
ID: "NOT_FOUND_SOCKET_VMNET",
ExitCode: ExProgramNotFound,
Advice: translate.T(`socket_vmnet was not found on the system, resolve by:

Option 1) Installing socket_vmnet:

https://minikube.sigs.k8s.io/docs/drivers/qemu/#networking

Option 2) Using the user network:

minikube start{{.profile}} --driver qemu --network user`),
Style: style.SeeNoEvil,
}
)
2 changes: 2 additions & 0 deletions site/content/en/docs/contrib/errorcodes.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ minikube was unable to safely downgrade installed Kubernetes version

"NOT_FOUND_DOCKERD" (Exit code ExProgramNotFound)

"NOT_FOUND_SOCKET_VMNET" (Exit code ExProgramNotFound)

## Error Codes


Expand Down
18 changes: 17 additions & 1 deletion site/content/en/docs/drivers/qemu.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,23 @@ When using the `user` network (default) the guest uses **only** the first `names

##### Workarounds:
1. If possible, reorder your `/etc/resolv.conf` to have a general `nameserver` entry first (eg. `8.8.8.8`) and reboot your machine.
2. (Coming soon) Use `--network=socket_vmnet`
2. Use `--network=socket_vmnet`

### 2. `/var/db/dhcpd_leases` errors

If you're seeing errors related to `/var/db/dhcpd_leases` we recommend the following:
1. Uninstall `socket_vmnet`:
```shell
cd socket_vmnet
sudo make uninstll
sudo rm /var/run/socket_vmnet
```
2. Reboot
3. Reinsitall `socket_vmnet`:
```shell
cd socket_vmnet
sudo make install
```

[Full list of open 'qemu' driver issues](https://github.com/kubernetes/minikube/labels/co%2Fqemu-driver)

Expand Down
8 changes: 5 additions & 3 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"--kvm-numa-count range is 1-8": "Der Wertebereich für --kvm-numa-count ist 1-8",
"--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "Der Parameter --network kann nur mit dem docker/podman und den KVM Treibern verwendet werden, er wird ignoriert werden",
"--network flag is only valid with the docker/podman, KVM and Qemu drivers, it will be ignored": "",
"--network with QEMU must be 'user' or 'socket_vmnet'": "",
"1) Recreate the cluster with Kubernetes {{.new}}, by running:\n\t \n\t\t minikube delete{{.profile}}\n\t\t minikube start{{.profile}} --kubernetes-version={{.prefix}}{{.new}}\n\t \n\t\t2) Create a second cluster with Kubernetes {{.new}}, by running:\n\t \n\t\t minikube start -p {{.suggestedName}} --kubernetes-version={{.prefix}}{{.new}}\n\t \n\t\t3) Use the existing cluster at version Kubernetes {{.old}}, by running:\n\t \n\t\t minikube start{{.profile}} --kubernetes-version={{.prefix}}{{.old}}\n\t\t": "1) Erstellen Sie den Cluster mit Kubernetes {{.new}} neu, indem Sie folgende Befehle ausführen:\n\t \n\t\t minikube delete{{.profile}}\n\t\t minikube start{{.profile}} --kubernetes-version={{.prefix}}{{.new}}\n\t \n\t\t2) Erstellen Sie einen zweiten Cluster mit Kubernetes {{.new}}, indem Sie folgende Befehle ausführen:\n\t \n\t\t minikube start -p {{.suggestedName}} --kubernetes-version={{.prefix}}{{.new}}\n\t \n\t\t3) Verwenden Sie den existierenden Cluster mit Version {{.old}} von Kubernetes, indem Sie folgende Befehle ausführen:\n\t \n\t\t minikube start{{.profile}} --kubernetes-version={{.prefix}}{{.old}}\n\t\t",
"1. Click on \"Docker for Desktop\" menu icon\n\t\t\t2. Click \"Preferences\"\n\t\t\t3. Click \"Resources\"\n\t\t\t4. Increase \"CPUs\" slider bar to 2 or higher\n\t\t\t5. Click \"Apply \u0026 Restart\"": "1. Klicken Sie auf das \"Docker für Desktop\" Menu Icon\n\t\t\t2. Klicken Sie auf \"Einstellungen\"\n\t\t\t3. Klicken Sie auf \"Resourcen\"\n\t\t\t4. Erhöhen Sie den Wert von \"CPUs\" auf 2 oder mehr\n\t\t\t5. Klicken Sie auf \"Anwenden \u0026 Neustarten\"",
"1. Click on \"Docker for Desktop\" menu icon\n\t\t\t2. Click \"Preferences\"\n\t\t\t3. Click \"Resources\"\n\t\t\t4. Increase \"Memory\" slider bar to {{.recommend}} or higher\n\t\t\t5. Click \"Apply \u0026 Restart\"": "1. Klicken Sie auf das \"Docker für Desktop\" Menu Icon\n\t\t\t2. Klicken Sie auf \"Einstellungen\"\n\t\t\t3. Klicken Sie auf \"Resourcen\"\n\t\t\t4. Erhöhen Sie den Wert von \"Speicher\" auf {{.recommend}} oder mehr\n\t\t\t5. Klicken Sie auf \"Anwenden \u0026 Neustarten\"",
Expand Down Expand Up @@ -72,6 +73,7 @@
"Auto-pause is already enabled.": "",
"Automatically selected the {{.driver}} driver": "Treiber {{.driver}} wurde automatisch ausgewählt",
"Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}": "Treiber {{.driver}} wurde automatisch ausgewählt. Andere Möglichkeiten: {{.alternates}}",
"Automatically selected the {{.network}} network": "",
"Available Commands": "Verfügbare Befehle",
"Basic Commands:": "Grundlegende Befehle:",
"Because you are using a Docker driver on {{.operating_system}}, the terminal needs to be open to run it.": "Weil Sie einen Docker Treiber auf {{.operating_system}} verwenden, muss das Terminal während des Ausführens offen bleiben.",
Expand Down Expand Up @@ -694,7 +696,6 @@
"The control plane node must be running for this command": "Der Kontroll-Ebenen-Node muss für diesen Befehl laufen",
"The cri socket path to be used": "Der zu verwendende Cri-Socket-Pfad",
"The cri socket path to be used.": "Der zu verwendende Cri-Socket-Pfad.",
"The default network for QEMU will change from 'user' to 'socket_vmnet' in a future release": "",
"The docker-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "Der docker-env Befehl ist inkompatibel mit multi-node Clustern. Bitte verwende das 'registry' Addon: https://minikube.sigs.k8s.io/docs/handbook/registry/",
"The docker-env command is only compatible with the \"docker\" runtime, but this cluster was configured to use the \"{{.runtime}}\" runtime.": "Der docker-env Befehl ist nur mit der \"Docker\" Laufzeitsumgebung kompatibel, aber dieser Cluster ist für die\"{{.runtime}}\" Laufzeitumgebung konfiguriert.",
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "Der Treiber '{{.driver}}' wird auf {{.os}}/{{.arch}} nicht unterstützt",
Expand Down Expand Up @@ -738,6 +739,7 @@
"The service namespace": "Der Namespace des Service",
"The service/ingress {{.resource}} requires privileged ports to be exposed: {{.ports}}": "Der Service/Ingress {{.resource}} benötigt, dass priviligierte Ports verwendet werden können: {{.ports}}",
"The services namespace": "Der Namespace des Service",
"The socket_vmnet network is only supported on macOS": "",
"The time interval for each check that wait performs in seconds": "Der Zeitintervall für jeden Check, den wait ausführt, in Sekunden",
"The value passed to --format is invalid": "Der mit --format angegebene Wert ist ungültig",
"The value passed to --format is invalid: {{.error}}": "Der mit --format angegebene Wert ist ungültig: {{.error}}",
Expand Down Expand Up @@ -854,7 +856,6 @@
"Using image repository {{.name}}": "Verwenden des Image-Repositorys {{.name}}",
"Using image {{.registry}}{{.image}}": "Verwende Image {{.registry}}{{.image}}",
"Using image {{.registry}}{{.image}} (global image repository)": "Verwende das Image {{.registry}}{{.image}} (globale Image Repository)",
"Using qemu with 'socket_vmnet' network is experimental": "",
"Using rootless Docker driver was required, but the current Docker does not seem rootless. Try 'docker context use rootless' .": "",
"Using rootless driver was required, but the current driver does not seem rootless": "",
"Using rootless {{.driver_name}} driver": "",
Expand Down Expand Up @@ -888,7 +889,7 @@
"You are trying to run a windows .exe binary inside WSL. For better integration please use a Linux binary instead (Download at https://minikube.sigs.k8s.io/docs/start/.). Otherwise if you still want to do this, you can do it using --force": "Sie versuchen eine Windows .exe Binärdatei innerhalb von WSL auszuführen. Bitte verwenden Sie stattdessen eine Linux Binärdatei für eine bessere Integration (Download-Möglichkeit: https://minikube.sigs.k8s.io/docs/start/.). Alternativ, wenn Sie dies wirklich möchten, können Sie dies mit --force erzwingen",
"You are trying to run amd64 binary on M1 system. Please consider running darwin/arm64 binary instead (Download at {{.url}}.)": "Sie versuchen ein amd64-Binärformat auf einem M1 System auszuführen. Bitte erwägen Sie eine darwin/amd64 Binärdatei stattdessen zu verwenden (Download-Möglichkeit: {{.url}})",
"You are trying to run the amd64 binary on an M1 system.\nPlease consider running the darwin/arm64 binary instead.\nDownload at {{.url}}": "",
"You are using the QEMU driver without a dedicated network, which doesn't support `minikube service` \u0026 `minikube tunnel` commands.\nTo try the experimental dedicated network see: https://minikube.sigs.k8s.io/docs/drivers/qemu/#networking": "",
"You are using the QEMU driver without a dedicated network, which doesn't support `minikube service` \u0026 `minikube tunnel` commands.": "",
"You can create one using 'minikube start'.\n\t\t": "Sie können einen mit 'minikube start' erstellen.\n\t\t",
"You can delete them using the following command(s): ": "Sie können diese mit dem folgenden Befehl/den folgenden Befehlen löschen:",
"You can force an unsupported Kubernetes version via the --force flag": "Sie können das Verwenden einer nicht unterstützten Kubernetes Version mit dem --force Parameter erzwingen",
Expand Down Expand Up @@ -1008,6 +1009,7 @@
"scheduled stop is not supported on the none driver, skipping scheduling": "Das geplante Stoppen wird von none Treiber nicht unterstützt, überspringe Planung",
"service {{.namespace_name}}/{{.service_name}} has no node port": "Service {{.namespace_name}}/{{.service_name}} hat keinen Node Port",
"set tunnel bind address, empty or '*' indicates the tunnel should be available for all interfaces": "",
"socket_vmnet was not found on the system, resolve by:\n\n\t\tOption 1) Installing socket_vmnet:\n\n\t\t https://minikube.sigs.k8s.io/docs/drivers/qemu/#networking\n\n\t\tOption 2) Using the user network:\n\n\t\t minikube start{{.profile}} --driver qemu --network user": "",
"stat failed": "state Fehler",
"status json failure": "Status json Fehler",
"status text failure": "Status text Fehler",
Expand Down
8 changes: 5 additions & 3 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"--kvm-numa-count range is 1-8": "--kvm-numa-count el rango es 1-8",
"--network flag is only valid with the docker/podman and KVM drivers, it will be ignored": "el flag --network es válido solamente con docker/podman y KVM, será ignorado",
"--network flag is only valid with the docker/podman, KVM and Qemu drivers, it will be ignored": "",
"--network with QEMU must be 'user' or 'socket_vmnet'": "",
"1) Recreate the cluster with Kubernetes {{.new}}, by running:\n\t \n\t\t minikube delete{{.profile}}\n\t\t minikube start{{.profile}} --kubernetes-version={{.prefix}}{{.new}}\n\t \n\t\t2) Create a second cluster with Kubernetes {{.new}}, by running:\n\t \n\t\t minikube start -p {{.suggestedName}} --kubernetes-version={{.prefix}}{{.new}}\n\t \n\t\t3) Use the existing cluster at version Kubernetes {{.old}}, by running:\n\t \n\t\t minikube start{{.profile}} --kubernetes-version={{.prefix}}{{.old}}\n\t\t": "",
"1. Click on \"Docker for Desktop\" menu icon\n\t\t\t2. Click \"Preferences\"\n\t\t\t3. Click \"Resources\"\n\t\t\t4. Increase \"CPUs\" slider bar to 2 or higher\n\t\t\t5. Click \"Apply \u0026 Restart\"": "",
"1. Click on \"Docker for Desktop\" menu icon\n\t\t\t2. Click \"Preferences\"\n\t\t\t3. Click \"Resources\"\n\t\t\t4. Increase \"Memory\" slider bar to {{.recommend}} or higher\n\t\t\t5. Click \"Apply \u0026 Restart\"": "",
Expand Down Expand Up @@ -74,6 +75,7 @@
"Auto-pause is already enabled.": "",
"Automatically selected the {{.driver}} driver": "Controlador {{.driver}} seleccionado automáticamente",
"Automatically selected the {{.driver}} driver. Other choices: {{.alternates}}": "Controlador {{.driver}} seleccionado automáticamente. Otras opciones: {{.alternates}}",
"Automatically selected the {{.network}} network": "",
"Available Commands": "Comandos disponibles",
"Basic Commands:": "Comandos basicos:",
"Because you are using a Docker driver on {{.operating_system}}, the terminal needs to be open to run it.": "Porque estás usando controlador Docker en {{.operating_system}}, la terminal debe abrirse para ejecutarlo.",
Expand Down Expand Up @@ -695,7 +697,6 @@
"The control plane node must be running for this command": "",
"The cri socket path to be used": "La ruta del socket de cri",
"The cri socket path to be used.": "",
"The default network for QEMU will change from 'user' to 'socket_vmnet' in a future release": "",
"The docker-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/": "",
"The docker-env command is only compatible with the \"docker\" runtime, but this cluster was configured to use the \"{{.runtime}}\" runtime.": "",
"The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}": "El controlador \"{{.driver}}\" no se puede utilizar en {{.os}}/{{.arch}}",
Expand Down Expand Up @@ -739,6 +740,7 @@
"The service namespace": "",
"The service/ingress {{.resource}} requires privileged ports to be exposed: {{.ports}}": "",
"The services namespace": "",
"The socket_vmnet network is only supported on macOS": "",
"The time interval for each check that wait performs in seconds": "",
"The value passed to --format is invalid": "",
"The value passed to --format is invalid: {{.error}}": "",
Expand Down Expand Up @@ -855,7 +857,6 @@
"Using image repository {{.name}}": "Utilizando el repositorio de imágenes {{.name}}",
"Using image {{.registry}}{{.image}}": "",
"Using image {{.registry}}{{.image}} (global image repository)": "",
"Using qemu with 'socket_vmnet' network is experimental": "",
"Using rootless Docker driver was required, but the current Docker does not seem rootless. Try 'docker context use rootless' .": "",
"Using rootless driver was required, but the current driver does not seem rootless": "",
"Using rootless {{.driver_name}} driver": "",
Expand Down Expand Up @@ -888,7 +889,7 @@
"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": "Parece que estás usando un proxy, pero tu entorno NO_PROXY no incluye la dirección IP de minikube ({{.ip_address}}). Consulta {{.documentation_url}} para obtener más información",
"You are trying to run a windows .exe binary inside WSL. For better integration please use a Linux binary instead (Download at https://minikube.sigs.k8s.io/docs/start/.). Otherwise if you still want to do this, you can do it using --force": "",
"You are trying to run the amd64 binary on an M1 system.\nPlease consider running the darwin/arm64 binary instead.\nDownload at {{.url}}": "",
"You are using the QEMU driver without a dedicated network, which doesn't support `minikube service` \u0026 `minikube tunnel` commands.\nTo try the experimental dedicated network see: https://minikube.sigs.k8s.io/docs/drivers/qemu/#networking": "",
"You are using the QEMU driver without a dedicated network, which doesn't support `minikube service` \u0026 `minikube tunnel` commands.": "",
"You can create one using 'minikube start'.\n\t\t": "",
"You can delete them using the following command(s): ": "",
"You can force an unsupported Kubernetes version via the --force flag": "",
Expand Down Expand Up @@ -1002,6 +1003,7 @@
"scheduled stop is not supported on the none driver, skipping scheduling": "",
"service {{.namespace_name}}/{{.service_name}} has no node port": "",
"set tunnel bind address, empty or '*' indicates the tunnel should be available for all interfaces": "",
"socket_vmnet was not found on the system, resolve by:\n\n\t\tOption 1) Installing socket_vmnet:\n\n\t\t https://minikube.sigs.k8s.io/docs/drivers/qemu/#networking\n\n\t\tOption 2) Using the user network:\n\n\t\t minikube start{{.profile}} --driver qemu --network user": "",
"stat failed": "",
"status json failure": "",
"status text failure": "",
Expand Down
Loading