<p>On my PC I have multiple network interfaces:</p>
<ol>
<li><code>lo 127.0.0.1</code> - loopback interface</li>
<li><code>enp2s0  192.168.1.244</code> - main interface</li>
<li><code>lo:40  192.168.40.1</code> - a virtual loopback device</li>
<li>others are irrelevant</li>
</ol>
<p>I am running apache on both the main interface and first loopback on ports <code>80</code> and <code>443</code>
And I need that apache to be undisturbed.</p>
<p>So I create a virtual loopback device for kubernetes to use with IP <code>192.168.40.1</code>
But every time I am trying to attach it to kubernetes it also grabs the main interface as well.</p>
<p>So far here is my ingress-controller config file (important parts):</p>
<pre><code>kind: Service
apiVersion: v1
metadata:
  name: traefik
  namespace: kube-system
spec:
  loadBalancerIP: 192.168.40.1
  externalIPs:
    - 192.168.40.1
  ports:
    - name: web
      protocol: TCP
      port: 1380
      targetPort: web
      nodePort: 32211
    - name: websecure
      protocol: TCP
      port: 13443
      targetPort: websecure
      nodePort: 32506
  selector:
    app.kubernetes.io/instance: traefik
    app.kubernetes.io/name: traefik
  clusterIP: 10.43.181.90
  clusterIPs:
    - 10.43.181.90
  type: LoadBalancer
  sessionAffinity: None
  externalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  allocateLoadBalancerNodePorts: true
  internalTrafficPolicy: Cluster
</code></pre>
<p>I tried changing both <code>externalIp</code> and <code>loadBalancerIP</code> settings but that only made kubernetes grab both <code>192.168.1.244</code> and <code>192.168.40.1</code>.</p>
<p>For some reason when I am trying to edit the file it shows an extra read-only section in the dashboard editor:</p>
<pre><code>status:
  loadBalancer:
    ingress:
      - ip: 192.168.1.244
</code></pre>
<p>I guess that is whats holding the interface.</p>
<p>How do I prevent Kubernetes from grabbing the main interface, and make it use only <code>192.168.40.1</code>?</p>

<p>k3s by default binds to first public system interface.<br />
To overwrite this behavior you need to provide <code>--node-ip=&lt;listen-ip&gt;</code> parameter to the server process.</p>
<p>Since there is no configuration (neither internal nor exteral) that allows to set that parameter, the only way of setting it is by modifying the systemd service file.</p>
<p>You have to modify <code>/etc/systemd/system/k3s.service</code> file and in last lines change</p>
<pre><code>ExecStart=/usr/local/bin/k3s \
    server \

</code></pre>
<p>to</p>
<pre><code>ExecStart=/usr/local/bin/k3s \
    server --node-ip=192.168.40.1 \

</code></pre>
<p>and restart kubernetes by running</p>
<pre><code>sudo systemctl daemon-reload
sudo systemctl restart k3s.service
</code></pre>
<p>This way Kubernetes will listen only on <code>192.168.40.1</code> using interface assigned to this ip.</p>
