@@ -132,7 +132,7 @@ the Cilium agent is running in the desired mode:
132132.. parsed-literal ::
133133
134134 kubectl exec -it -n kube-system cilium-fmh8d -- cilium status | grep KubeProxyReplacement
135- KubeProxyReplacement: Strict ( eth0) [NodePort (SNAT, 30000-32767, XDP: NONE), HostPort, ExternalIPs, HostReachableServices (TCP, UDP)]
135+ KubeProxyReplacement: Strict [ eth0 (DR), eth1] [NodePort (SNAT, 30000-32767, XDP: NONE), HostPort, ExternalIPs, HostReachableServices (TCP, UDP)]
136136
137137 As a next, optional step, we deploy nginx pods, create a new NodePort service and
138138validate that Cilium installed the service correctly.
@@ -186,8 +186,8 @@ Verify that the NodePort service has been created:
186186 my-nginx NodePort 10.104.239.135 <none> 80:31940/TCP 24m
187187
188188 With the help of the ``cilium service list `` command, we can validate that
189- Cilium's BPF kube-proxy replacement created the new NodePort service under
190- port ``31940 ``:
189+ Cilium's BPF kube-proxy replacement created the new NodePort services under
190+ port ``31940 `` (one per `` eth0 `` and `` eth1 `` devices) :
191191
192192.. parsed-literal ::
193193
@@ -200,6 +200,8 @@ port ``31940``:
200200 2 => 10.217.0.149:80
201201 6 192.168.178.29:31940 NodePort 1 => 10.217.0.107:80
202202 2 => 10.217.0.149:80
203+ 7 172.16.0.29:31940 NodePort 1 => 10.217.0.107:80
204+ 2 => 10.217.0.149:80
203205
204206 At the same time we can inspect through ``iptables `` in the host namespace
205207that no ``iptables `` rule for the service is present:
@@ -221,6 +223,24 @@ NodePort port ``31940`` as well as for the ClusterIP:
221223 <title>Welcome to nginx!</title>
222224 [....]
223225
226+ .. parsed-literal ::
227+
228+ curl 192.168.178.29:31940
229+ <!doctype html>
230+ <html>
231+ <head>
232+ <title>welcome to nginx!</title>
233+ [....]
234+
235+ .. parsed-literal ::
236+
237+ curl 172.16.0.29:31940
238+ <!doctype html>
239+ <html>
240+ <head>
241+ <title>welcome to nginx!</title>
242+ [....]
243+
224244 .. parsed-literal ::
225245
226246 curl 10.104.239.135:80
@@ -316,20 +336,24 @@ mode would look as follows:
316336 --set global.k8sServiceHost=API_SERVER_IP \\
317337 --set global.k8sServicePort=API_SERVER_PORT
318338
339+ .. _XDP acceleration :
340+
319341NodePort XDP Acceleration
320342*************************
321343
322- Cilium has built-in support for accelerating NodePort, ExternalIPs and LoadBalancer
323- services for the case where the arriving request needs to be pushed back out of the
324- node when the backend is located on a remote node. This ability to act as a hairpin
325- load balancer can be handled by Cilium at the XDP (eXpress Data Path) layer where BPF
326- is operating directly in the networking driver instead of a higher layer.
344+ Cilium has built-in support for accelerating NodePort, LoadBalancer services and
345+ services with externalIPs for the case where the arriving request needs to be
346+ pushed back out of the node when the backend is located on a remote node. This
347+ ability to act as a hairpin load balancer can be handled by Cilium at the XDP
348+ (eXpress Data Path) layer where BPF is operating directly in the networking driver
349+ instead of a higher layer.
327350
328351The mode setting ``global.nodePort.acceleration `` allows to enable this acceleration
329352through the option ``native ``. The option ``disabled `` is the default and disables the
330353acceleration. The majority of drivers supporting 10G or higher rates also support
331354``native `` XDP on a recent kernel. For cloud based deployments most of these drivers
332- have SR-IOV variants that support native XDP as well.
355+ have SR-IOV variants that support native XDP as well. The acceleration can be
356+ enabled only on a single device which is used for direct routing.
333357
334358The ``global.nodePort.acceleration `` setting is supported for DSR, SNAT and hybrid
335359modes and can be enabled as follows for ``nodePort.mode=hybrid `` in this example:
@@ -404,20 +428,37 @@ is shown:
404428.. parsed-literal ::
405429
406430 kubectl exec -it -n kube-system cilium-xxxxx -- cilium status | grep KubeProxyReplacement
407- KubeProxyReplacement: Strict [NodePort (SNAT, 30000-32767, XDP: NATIVE), HostPort, ExternalIPs, HostReachableServices (TCP, UDP)]
431+ KubeProxyReplacement: Strict [eth0 (DR), eth1] [NodePort (SNAT, 30000-32767, XDP: NATIVE), HostPort, ExternalIPs, HostReachableServices (TCP, UDP)]
432+
433+ In the example above, the NodePort XDP acceleration is enabled on the ``eth0 `` device,
434+ because it used for direct routing (``DR ``).
408435
409436Note that packets which have been pushed back out of the device for NodePort handling
410437right at the XDP layer are not visible in tcpdump since packet taps come at a much
411438later stage in the networking stack. Cilium's monitor or metric counters can be used
412439instead for gaining visibility.
413440
414- NodePort Device , Port and Bind settings
415- ***************************************
441+ NodePort Devices , Port and Bind settings
442+ ****************************************
416443
417444When running Cilium's BPF kube-proxy replacement, by default, a NodePort or
418- ExternalIPs service will be accessible through the IP address of a native device
419- which has the default route on the host. To change the device, set its name in
420- the ``global.devices `` helm option.
445+ LoadBalancer service or a service with externalIPs will be accessible through
446+ the IP addresses of native devices which have the default route on the host or
447+ have Kubernetes InternalIP or ExternalIP assigned. InternalIP is preferred over
448+ ExternalIP if both exist. To change the devices, set their names in the
449+ ``global.devices `` helm option, e.g. ``global.devices={eth0,eth1,eth2} ``. Each
450+ listed device has to be named the same on all Cilium managed nodes.
451+
452+ When multiple devices are used, only one device can be used for direct routing
453+ between Cilium nodes. By default, if a single device was detected or specified
454+ via ``global.devices `` then Cilium will use that device for direct routing.
455+ Otherwise, Cilium will use a device with Kubernetes InternalIP or ExternalIP
456+ being set. InternalIP is preferred over ExternalIP if both exist. To change
457+ the direct routing device, set the ``global.nodePort.directRoutingDevice `` helm
458+ option, e.g. ``global.nodePort.directRoutingDevice=eth1 ``. If the direct
459+ routing device does not exist within ``global.devices ``, Cilium will add the
460+ device to the latter list. The direct routing device is used for
461+ :ref: `the NodePort XDP acceleration<XDP Acceleration> ` as well (if enabled).
421462
422463In addition, thanks to the :ref: `host-services ` feature, the NodePort service can
423464be accessed by default from a host or a pod within a cluster via its public, any
@@ -426,7 +467,7 @@ local (except for ``docker*`` prefixed names) or loopback address, e.g.
426467
427468If ``kube-apiserver `` was configured to use a non-default NodePort port range,
428469then the same range must be passed to Cilium via the ``global.nodePort.range ``
429- option, for example, as ``--set global.nodePort.range="10000\,32767" `` for a
470+ option, for example, as ``global.nodePort.range="10000\,32767" `` for a
430471range of ``10000-32767 ``. The default Kubernetes NodePort range is ``30000-32767 ``.
431472
432473If the NodePort port range overlaps with the ephemeral port range
@@ -655,7 +696,7 @@ The current Cilium kube-proxy replacement mode can also be introspected through
655696.. parsed-literal ::
656697
657698 kubectl exec -it -n kube-system cilium-xxxxx -- cilium status | grep KubeProxyReplacement
658- KubeProxyReplacement: Strict ( eth0) [NodePort (SNAT, 30000-32767, XDP: NONE), HostPort, ExternalIPs, HostReachableServices (TCP, UDP)]
699+ KubeProxyReplacement: Strict [ eth0 (DR)] [NodePort (SNAT, 30000-32767, XDP: NONE), HostPort, ExternalIPs, HostReachableServices (TCP, UDP)]
659700
660701 Session Affinity
661702****************
0 commit comments