How to access all physical host network interfaces from container?

700 Views Asked by At

Requirement: If I do ifconfig, then I want to see the physical interface cards, which I need to access to be used inside a container.

Why? - coz i need to create a socket from container to interface NOTE: This interface has to be accessed at OSI Layer 2 and not with IP.

What I Tried (Privileged hostnetwork mode. Don't follow this, it may not be right) It's very insecure and risky way to achieve it.

root@canmaster:~# cat priv.yaml

apiVersion: v1
kind: Pod
metadata:
name: privileged
spec:
hostNetwork: true
hostname: canmasterpriv
containers:
- name: pause
image: docker.io/nginx:stable-perl
securityContext:
privileged: true
0

There are 0 best solutions below