kubedock icon indicating copy to clipboard operation
kubedock copied to clipboard

Start Container with Multiple Network Interfaces

Open connor-stewarty opened this issue 11 months ago • 2 comments

My tests require having two network interfaces. I previously accomplished this with podman running on Linux by creating podman networks to connect to containers. With kubedock, the podman network command appears to run using the local podman instead of the kubedock api socket.

How can I start a container with multiple network interfaces: eth0, eth1?

Environment:

  • OpenShift Dev Spaces

connor-stewarty avatar Jan 07 '25 21:01 connor-stewarty

This is not yet supported, kubedock flattens all networks into one at the moment.

joyrex2001 avatar Jan 08 '25 18:01 joyrex2001

I ended up finding a way I could do it.

First I made a NetworkAttachmentDefinition to make another network.

apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: eth1-network
  namespace: user-devspaces
spec:
  config: '{
    "cniVersion": "0.3.1",
    "name": "bridge-net",
    "type": "bridge",
    "isGateway": true,
    "vlan": 2,
    "ipam": {
      "type": "static",
      "addresses": [
        {
          "address": "192.168.1.100/24",
          "gateway": "192.168.1.1"
        }
      ]
    }
  }'

Then I used the annotation config option to attach the network to the pods that kubedock creates.

--annotation k8s.v1.cni.cncf.io/networks=eth1-network

Sources: https://docs.openshift.com/container-platform/4.16/networking/multiple_networks/configuring-additional-network.html#nw-multus-bridge-object_configuring-additional-network https://docs.openshift.com/container-platform/4.16/networking/multiple_networks/attaching-pod.html

connor-stewarty avatar Jan 08 '25 20:01 connor-stewarty