Open
Description
What happened?
While enabling DSR for a service kube-router is failing with linux_networking.go:534] Failed to add route for 199.27.151.9 in custom route table for external IP's due to: exit status 1
What did you expect to happen?
DSR should get enabled successfully
How can we reproduce the behavior you experienced?
This is my service manifest
apiVersion: v1
kind: Service
metadata:
annotations:
kube-router.io/service.dsr: "tunnel"
name: echo-server-lb
spec:
externalTrafficPolicy: Cluster
selector:
app: echo-server
ports:
- protocol: TCP
port: 8080
targetPort: 8080
externalIPs:
- 199.27.151.9
After applying the service manifest I see the error in kube-router logs
System Information (please complete the following information)
- Kube-Router Version (
kube-router --version
):v2.2.2-dirty
- Kube-Router Parameters:
--kubeconfig=/usr/local/kube-router/kube-router.kubeconfig
--run-router=true
--run-firewall=true
--run-service-proxy=true
--v=3
--peer-router-ips=xxx
--peer-router-asns=65322
--cluster-asn=65321
--enable-ibgp=false
--enable-overlay=false
--bgp-graceful-restart=true
--bgp-graceful-restart-deferral-time=30s
--bgp-graceful-restart-time=5m
--service-external-ip-range=199.27.151.8/30
--runtime-endpoint=unix:///run/containerd/containerd.sock
--enable-ipv6=true
--advertise-external-ip=true
--routes-sync-period=1m0s
--iptables-sync-period=1m0s
--ipvs-sync-period=1m0s
--hairpin-mode=true
--advertise-pod-cidr=true
- Kubernetes Version (
kubectl version
) : 1.29 - Cloud Type: on premise
- Kubernetes Deployment Type: manual installation of kubernetes
- Kube-Router Deployment Type: System Service
- Cluster Size: 2 Nodes
Logs, other output, metrics
I0421 11:22:15.086394 545684 service_endpoints_sync.go:95] Setting up DSR Services
I0421 11:22:15.086410 545684 service_endpoints_sync.go:605] Setting up policy routing required for Direct Server Return functionality.
I0421 11:22:15.086439 545684 linux_routing.go:30] Did not find iproute2's rt_tables in location /usr/lib/iproute2/rt_tables
I0421 11:22:15.086454 545684 linux_routing.go:30] Did not find iproute2's rt_tables in location /usr/share/iproute2/rt_tables
I0421 11:22:15.090968 545684 service_endpoints_sync.go:610] Custom routing table kube-router-dsr required for Direct Server Return is setup as expected.
I0421 11:22:15.091009 545684 service_endpoints_sync.go:613] Setting up custom route table required to add routes for external IP's.
I0421 11:22:15.091039 545684 linux_routing.go:30] Did not find iproute2's rt_tables in location /usr/lib/iproute2/rt_tables
I0421 11:22:15.091055 545684 linux_routing.go:30] Did not find iproute2's rt_tables in location /usr/share/iproute2/rt_tables
E0421 11:22:15.098804 545684 linux_networking.go:534] Failed to add route for 199.27.151.9 in custom route table for external IP's due to: exit status 1
I0421 11:22:15.098836 545684 service_endpoints_sync.go:621] Custom routing table required for Direct Server Return (external_ip) is setup as expected.
I0421 11:22:15.098859 545684 service_endpoints_sync.go:107] IPVS servers and services are synced to desired state
I0421 11:22:15.098872 545684 service_endpoints_sync.go:32] sync ipvs services took 1.990680596s
Additional context
- iproute2 version is
5.10.0-4
- kube-router is running as root and has the permission to edit
/etc/iproute2/rt_tables
on the host.
$ cat /etc/iproute2/rt_tables
...
77 kube-router
78 kube-router-dsr
79 external_ip