Receiving inbound unicast UDP traffic to Multus network interface

I was wondering if someone could help me with a complex Kubernetes ingress routing question.

The high level objective is to receive Unicast UDP traffic from outside the Kb8s cluster to a pod’s multus network interface.

I deploy a Multus network interface to a pod and am looking to direct UDP unicast traffic via my Nginx ingress controller using either a NodePort or HostPort.

Outbound unicast UDP traffic from inside the Pod to outside the k8s cluster works just fine, the current issue i’m facing is with ingress Unicast traffic to my pod via a nodePort or HostPort.

Please see below for details:

Kubernetes distro: Tried Kubeadm and Microk8s
Kubernetes version: 1.29
Kubernetes worker IP: 192.168.33.163
OS version: Ubuntu 20.04
Kernel version: 5.15.0-102-generic
Networking: ens2f0np0 is connected to a separate physical network to default nic eno1 and uses all Layer 2 switching. The host level network is 192.168.33.0/24 and the nat'ed multus net is 10.10.5.0/24

See example of attempt to expose using NodePort:

net-attach-def.yaml

apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: unicast-ipvlan
  namespace: default 
spec:
  config: '{
      "cniVersion": "0.3.0",
      "type": "ipvlan",
      "master": "ens2f0np0",
      "mode": "l2",
      "ipam": {
        "type": "host-local",
        "subnet": "10.10.5.0/24",
        "rangeStart": "10.10.5.2",
        "rangeEnd": "10.10.5.80",
        "gateway": "10.10.5.1",
        "routes": [
          {
            "dst": "0.0.0.0/0"
          },
            { "dst": "192.168.33.0/24", "gw": "10.10.5.1" }
        ]
      }
    }'

pod-and-service.yaml

apiVersion: v1
kind: Pod
metadata:
  name: ipvlan-test
  namespace: default
  annotations:
    k8s.v1.cni.cncf.io/networks: '[{ "name": "unicast-ipvlan", "ips": [ "10.10.5.2/32" ] }]'
  labels:
    app: net-tools
spec:
  containers:
  - image: george7522/net-tools:ubuntu
    command: [ "/bin/sh", "-c" ]
    args: ["sleep 1000000"]
    imagePullPolicy: Always
    name: net-tools
    securityContext:
      privileged: true
    securityContext:
      privileged: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  preemptionPolicy: PreemptLowerPriority
  priority: 0
  restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name: net-tools-test
  namespace: default
spec:
  type: NodePort
  ports:
    - port: 30003
      targetPort: 30003
      protocol: UDP
      nodePort: 30003
  selector:
    app: net-tools
---
apiVersion: v1
kind: Endpoints
metadata:
  name: sriov-test
  namespace: hpsample
subsets:
- addresses:
  - ip: "10.10.5.2"  # This is IP of the secondary multus interface of ipvlan-test
  ports:
  - port: 30003
    protocol: UDP

Here’s the output of various iptables commands on the host;

  • kube-proxy nat rules
$ sudo iptables -t nat -L -n -v | grep -i 30003
    1    36 DNAT       udp  --  *      *       0.0.0.0/0            0.0.0.0/0            /* hpsample/sriov-test */ udp to:10.10.5.2:30003
    1    36 KUBE-SEP-GIVWTBWIZR56HMIN  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* hpsample/sriov-test -> 10.10.5.2:30003 */
  • unicast routes
$ ip route
default via 192.168.42.254 dev eno1 proto static
default via 192.168.33.254 dev ens2f0np0 proto static metric 101
10.10.5.0/24 via 192.168.33.254 dev ens2f0np0
10.96.0.0/12 dev cni0 proto kernel scope link src 10.96.0.1

I’ve tried:

  • HostPort instead of NodePort

  • mode=l3 instead of mode=l2

  • What works?

I can successfully send UDP packets from another host on the 192.168.33.0/24 subnet to my kubernetes worker host 192.168.33.163, so I know networking is correct on the host level.

  • How am I testing the pod networking?

Setup a listener inside the pod to listen on the multus nic:

$ kubectl exec -it -n hpsample sriov-test bash  
$ socat UDP4-RECVFROM:30003,bind=10.10.5.2,fork STDOUT

Connect to another physical server on the same network, add a unicast route and send a UDP packet.

ssh [email protected]
$ sudo ip route add 10.10.5.0/24 via 192.168.33.254 dev ens34
$ echo "Hello unicast" | socat - UDP4-DATAGRAM:10.10.5.2:30003,bind=192.168.33.111

New contributor

Cogito Group is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật