Skip to main content
Version: v1.0.0

Stateless Load-balancer

Description

The load balancer is using a user space Maglev implementation to load balance traffic among multiple targets.

At Start, the load balancer is subscribing to events from the NSP Service to get notifications about target registration / unregistration in order to update the identifiers in the nfqueue-loadbalancer program, the IP rules and the IP routes.

Since the nfqueue-loadbalancer program is running in user space, iptables together with nfqueue are used to bring traffic from kernel space to user space. The nfqueue-loadbalancer program will then add a forwarding mark on the traffic based on Maglev and according to the registered target identifiers, and will return the traffic to the kernel space. Using the forwarding mark, IP rules and IP routes, the traffic will be forwarded to the selected target.

Configuration

https://github.com/Nordix/Meridio/blob/master/cmd/load-balancer/config.go

Environment variableTypeDescriptionDefault
NSM_NAMEstringName of the podload-balancer
NSM_SERVICE_NAMEstringName of providing serviceload-balancer
NSM_CONNECT_TOurl.URLurl to connect to NSMunix:///var/lib/networkservicemesh/nsm.io.sock
NSM_DIAL_TIMEOUTtime.Durationtimeout to dial NSMgr5s
NSM_REQUEST_TIMEOUTtime.Durationtimeout to request NSE15s
NSM_MAX_TOKEN_LIFETIMEtime.Durationmaximum lifetime of tokens24h
NSM_NSP_SERVICEstringIP (or domain) and port of the NSP Servicensp-service:7778
NSM_CONDUIT_NAMEstringName of the conduitload-balancer
NSM_TRENCH_NAMEstringTrench the pod is running ondefault
NSM_LOG_LEVELstringLog levelDEBUG
NSM_NFQUEUEstringnetfilter queue(s) to be used by nfqlb0:3
NSM_NFQUEUE_FANOUTboolenable fanout nfqueue optionfalse

Command Line

CommandActionDefault
--helpDisplay a help describing
--versionDisplay the version

Communication

ComponentSecuredMethod
SpireTBDUnix Socket
NSMyes (mTLS)Unix Socket
NSP Serviceyes (mTLS)TCP

Health check

TODO

Privileges

NameDescription
Sysctl: net.ipv6.conf.all.forwarding=1
Sysctl: net.ipv4.conf.all.forwarding=1
Sysctl: net.ipv4.fib_multipath_hash_policy=1
Sysctl: net.ipv6.fib_multipath_hash_policy=1
Sysctl: net.ipv4.conf.all.rp_filter=0
Sysctl: net.ipv4.conf.default.rp_filter=0
NET_ADMINThe load balancer configures IP rules and IP routes to steer packets (processed by nfqueue-loadbalancer program) to targets. The user space load balancer program relies on libnetfilter_queue.
IPC_LOCKThe user space load balancer program uses shared memory.
IPC_OWNERThe user space load balancer program uses shared memory.