<p>I'm setting up minikube using VirtualBox as the VM driver using a <strong>NAT adapter</strong> and a <strong>host-only adapter</strong>. After the VM is created, I run a few pods one of which is Kafka (the messaging queue). I have issues using Kafka properly because the VM creates 2 network interfaces <code>eth0</code> which points to <code>10.0.2.15</code> and <code>eth1</code> which points to <code>192.168.99.100</code> which is the IP the host-only adapter is set up with.</p>

<p>I'm running this on a Mac, so I've tried using HyperKit instead, which seems to work differently. So, when using HyperKit I get one interface <code>eth0</code> which points to 192.168.99.100 and everything works just fine.</p>

<p><strong>Why does VirtualBox create 2 interfaces, i.e. <code>eth0</code> and <code>eth1</code>?</strong></p>

<pre><code>|           Host           |   |          VM           |
|--------------------------|   |-----------------------|
| vboxnet0 (192.168.99.100)|   | eth0 (10.0.2.15)      | &lt;--- why is this created?
|           ...            |   | eth1 (192.168.99.100) |
</code></pre>

<p>As a side note, Kafka is using <code>PLAINTEXT://:9092</code> in the listeners setting, which makes it start the server using <code>eth0</code> and as a result <code>10.0.2.15</code>. This IP is later advertised to any consumer connecting to it. This IP seems to be accessible only within the VM, which makes impossible to connect from the outside, e.g. the host. To be precise, a consumer connects to Kafka, then Kafka sends the advertised listeners, i.e. <code>10.0.2.15</code> and then it cannot send any messages, because it tries to connect to <code>10.0.2.15</code>.</p>

ipinak
<blockquote>
  <p>| eth0 (10.0.2.15)      | &lt;--- why is this created?</p>
</blockquote>

<p>Basically, VirtualBox needs 2 interfaces because it uses the <code>vboxnet0 eth0</code> interface to talk to the outside world using NAT and the other interface <code>eth1</code> on the <code>192.168.99.x</code> net so that your machine can talk to the VM. <code>192.168.99.100</code> is used by <code>minikube ssh</code>.  You can try it directly by running <code>ssh -i private_key docker@192.168.99.100</code>  and getting the private key from running <code>minikube ssh-key</code></p>

<p><a href="https://github.com/moby/hyperkit" rel="nofollow noreferrer">HyperKit</a> doesn't need two interfaces because as you noticed it has <code>192.168.99.100</code> which minikube also uses to connect through ssh. HyperKit VMs don't necessarily need an interface to connect to the outside. For that, it generally uses a different mechanism based on <a href="https://github.com/moby/vpnkit" rel="nofollow noreferrer">VPNKit</a>.</p>

<p>My suggestion is to use the <a href="http://kafka.apache.org/090/documentation.html#brokerconfigs" rel="nofollow noreferrer"><code>advertised.host.name</code></a> option in your Kafka configs. Another alternative is to upstream an option in <a href="https://github.com/kubernetes/minikube" rel="nofollow noreferrer">minikube</a> that allows you to change the order of the ethernet interfaces on VirtualBox, but that would be more work.</p>
