apiVersion: v1
kind: Pod
metadata:
name: shared-namespace
spec:
containers:
- name: p1
image: busybox
command: ['/bin/sh', '-c', 'sleep 10000']
- name: p2
image: nginx
Commands
ip netns list
kubectl run nginx --image=nginx
lsns | grep nginx
copy the process IP from above and run
lsns -p <pid>
ls -lt /var/run/netns
ip netns exec <namespace> ip link
kubectl exec -it shared-namespace -- ip addr #run this on controlplane
Now you will see eth@9
-> after @
there will be a number and you can then search its corresponding link on the node using
ip link | grep -A1 ^9
you will be able to see the same network namespace after link
These are the veth pairs or based on the CNI
===========================
-
List all network interfaces on the host:
ip link show
-
List network namespaces:
sudo ip netns list
-
Inspect network interfaces within a specific namespace:
Replace
<namespace>
with the actual namespace ID (e.g.,cni-6bbf75c3-3284-407a-5869-90772afb5472
).sudo ip netns exec <namespace> ip link
-
Find veth pairs on the host:
ip link show | grep cali
-
Verify the veth pair connection:
Replace
<interface>
with the actual veth interface name (e.g.,caliede2c6f02d9
).sudo ethtool -S <interface>
-
List all interfaces:
ip link show
-
List network namespaces:
sudo ip netns list
-
Inspect network interfaces within the namespace
cni-6bbf75c3-3284-407a-5869-90772afb5472
:sudo ip netns exec cni-6bbf75c3-3284-407a-5869-90772afb5472 ip link
-
Find veth pairs on the host:
ip link show | grep cali
-
Verify the veth pair connection for interface
caliede2c6f02d9
:sudo ethtool -S caliede2c6f02d9
These commands will help you identify the network interfaces and veth pairs created by the CNI plugin, and inspect the network configuration for your Pods.