Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start Container with Multiple Network Interfaces #121

Open
connor-stewarty opened this issue Jan 7, 2025 · 2 comments
Open

Start Container with Multiple Network Interfaces #121

connor-stewarty opened this issue Jan 7, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@connor-stewarty
Copy link

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
@joyrex2001 joyrex2001 added the enhancement New feature or request label Jan 8, 2025
@joyrex2001
Copy link
Owner

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

@connor-stewarty
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants