Hi, has anyone tried running a self-hosted SIP ser...
# self-hosting
n
Hi, has anyone tried running a self-hosted SIP server inside Kubernetes? The documentation shows a Docker Compose example — is it possible to run it inside k8s? https://docs.livekit.io/home/self-hosting/sip-server/
n
Hi @narrow-ice-25787 Yes, I have working implementations in Kubernetes for SIP
ā¤ļø 3
which k8s distro are you using? or which cloud?
there's a lot of dependency on these šŸ˜„
n
ooo nice! thank you for your response. We use AWS šŸ˜„
n
so I suggest to try this: • have a public EKS cluster where all nodes have a public IP • run the SIP pods (deployment) in
hostNetwork: true
config so they use the node's network namesapce • use port range for RTP that is not conflicting with k8s networking, e.g. 40000 - 41000 • open these ports on EC2 security group associated with the EKS node pool • use the
use_external_ip: true
in the SIP server config • still create a LoadBalancer to the SIP Server for port 5060 (that is the signalling port, it will need stable IP) • give this load balancer IP (it's actually an AWS specific hostname) a domain and use that in your provider setup
if you are unable to do any of these step let me know, e.g. in many enterprise clusters you cannot run a public cluster, or you cannot run hostNetworking pods due to security rules
i
@narrow-cricket-87449 thank you for hits! I have few follow up questions: 1. How well it scales and work with multiple SIP server instances? 2. Do you have any recommendation or rule of thumb about replica count/proportion for livekit-server and livekit-sip? 3. Are they any particular settings for LoadBalancer that works better or maybe some that should be avoided? 4. I'm not SIP expert, but I'm aware of issues with call "stickiness" - at least with Asterisk setups.. We had issues with "generic" load balancers not understanding SIP protocol. We had to setup Kamailio as dispatcher/redirect server to handle this. Maybe it's LiveKit "secret sauce" that makes it work with regular LB or maybe we messed up something.. šŸ¤”
n
so generally SIP and Cloud Load Balancing (either with or wtithout Kubernetes) are very unfriendly to each other
the problem is that you can Load Balance between multiple LiveKit SIP servers for the SIP signalling, which will get routed to one specific instance, but then you have to specifically route to the same exact instance with the RTP voice traffic
using hostNetworking and
use_external_ip: true
will circumvent this, since all the SIP servers will advertise a unique address (their public node address basically) so the RTP will found back to the given instance
you can't really do this with a normal pod behind a normal load balancer (at least for the RTP part)
so in general this would be quite scalable as long as you know that you can run only one LiveKit SIP server per node (since they use the host network namespace, so two of them would have colliding ports), so you have to have a few nodes in the cluster
(and also host networking is sometimes flat out unpermitted by some policy in case of very heavy security rules, we meet these teams quite often)
but LiveKit SIP will only handle audio only which in general not that much traffic
LiveKit itself is very performant, one pod (in a good sized node) can handle 1000s of connection using HD video, and audio is much more lightweight
and LiveKit SIP essentially uses (almost) the same dataplane libs, so one SIP server alone should handle 1000s of paralell calls with no problem
I have to admit we have not run proper performance measurement for the SIP side, these are just educated guesses and also our current production setups (we also have one, and we support a handful of clients) only handle a few dozens of calls at this point
here are the official banchmarks (but again this is for the normal LiveKit server and the main load is due to the video traffic): https://docs.livekit.io/home/self-hosting/benchmark/
in general any cloud you're in, you sould find an L4 load balancer for the SIP server, since the will handle it better
stickyness always an issue as I mentioned, but this hostnetworking hack can circumvent that
otherwise yeah: you might need some SIP shenanigans like Kamailio, but lucky enough we were able to avoid this at our current setup šŸ˜„
i
Thank you for update, lots of priceless information - I have to process this and probably I'll be back with follow up questions šŸ˜‰
ā¤ļø 1
s
Hi @narrow-cricket-87449 , could you share you guidance if you have tested out deploying on GKE // Google cloud, would appreciate any inputs you may have!