如何在特定网络上启动 minikube

How to start minikube on specific network

我想在 VirtualBox 中的特定网络/network adapter 上启动 minikube 集群,以便我在同一网络中启动其他 VM,如下所示

+-------+ +------+  +----------------+
|       | |      |  |                |
| VM2   | | VM1  |  | Minikube       |
|       | |      |  | Cluster        |
|       | |      |  |                |
+---+---+ +---+--+  +------------+---+
    |         |                  |
    |         |                  |
    |  +------+------------+     |
    +--+                   |     |
       |  192.168.10.0/24  +-----+
       +-------------------+

但我在 minikube start CLI

中没有看到太多网络选项

是否可以像那样启动 minikube 或像上面那样设置任何技巧?

我再次检查过,minikube 集群连接到 2 个网络,

  1. NAT
  2. 仅主机网络(vboxnet1)

因为它已经连接到一个适配器,我可以将 VM 附加到退出的适配器并像下面那样使用它

+--------+            +---------------------+
|        |            |    Minikube         |
|        |            |                     |
| VM     |            |  eth1          eth0 |
|        |            |   +             +   |
|        |            +---------------------+
+---+----+                |             |
    |                     |             |
    |                     |             |
    |        +------------v------+      |
    |        |                   |      v
    +------->+   vboxnet1        |     NAT
             |   192.168.99.0/24 |
             |                   |
             +-------------------+

欢迎提出任何其他建议

当谈到调整网络minikube start时,您可以使用以下选项:

--host-only-cidr string             The CIDR to be used for the minikube VM (only supported with Virtualbox driver) (default "192.168.99.1/24")

正如您在 table here by default NAT option doesn't give you access to Minikube Cluster VM neither from host nor from other guests (VMs) but you can additionally set port forwarding which is well described in this 文章中看到的那样。

尽管提到的 minikube start 不支持许多允许您修改默认 VM 网络的选项,但一旦 Minikube VM 已启用,您可以通过添加额外的 bridged adapter 轻松修改它使用 Virtualbox GUIvboxmanage 命令行工具创建,按照某些用户的建议修改您的网络设置 here and here.