<p>How can one create a second network interface for a pod. </p>

<p>In particular, I actually have a use case where second network interface should be ideally shared network interface to the host('s 2nd network interface) because the host has second network domain? </p>

<p>The external service (on a separate subnet as the host) is not controlled within the same cluster(and controlled by some other vendoring). It is limiting its access by whitelisting client ips. </p>

<p>Please advice.</p>

<p>Thanks.</p>

<p>To share network interfaces between pod and host. You need to start the pod with host mode, which means pod will share the same network namespace with the host node.</p>

<p>In the pod configuration file, you need to specify "hostNetwork: true".</p>

<p>And for Kubernetes version before 1.1, you need to use --host-network-sources="*" option when start kubelet.</p>

<p>Following is the example pod configuration file:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test
spec:
  hostNetwork: true
  restartPolicy: Never
  containers:
  - name: test
    image: ubuntu
    command: ["bash", "sleep 1000"]
</code></pre>

<p>Following is the example kublet command:</p>

<pre><code>kubelet --api_servers=http://$MASTER_IP:8080 --address=0.0.0.0 --cluster_dns=10.0.0.10 --cluster_domain="kubernetes.local" --host-network-sources="*" --pod-infra-container-image="kiwenlau/pause:0.8.0
</code></pre>

<p>References:</p>

<p><a href="https://stackoverflow.com/questions/34149068/kubernetes-specified-host-networking-but-is-disallowed">kubernetes specified host networking, but is disallowed?</a>
<a href="https://stackoverflow.com/questions/35791446/kubernetes-network-performance-issue-moving-service-from-physical-machine-to-ku/35801600#35801600">kubernetes network performance issue: moving service from physical machine to kubernetes get half rps drop</a></p>
