Recently, WebRTC has become more preferred because of the deficiencies in the protocol support of browser-based applications. WebRTC provides real-time communication over peer-to-peer protocol. WebRTC protocol needs two browser client to communicate. Highly Available Janus Gateway easily configured and deployed on Kubernetes cluster. In the following architecture, if any of the Kubernetes Node fails, one of any other Kubernetes Node will take all responsibility. This allows us to build an Active-Passive High Availability Clustering architecture.
In Janus, each plugin has its own configuration and one for general purposes such as Real-time Transport Protocol (RTP) Port Range and NAT settings. The first configuration responsible for general configurations and the second one is responsible of Streaming Plugin configurations.
In the streaming configuration, two-room created for streaming. For more detailed configuration explanations and examples, please visit Janus Streaming Plugin Configuration Sample and Janus Configuration Sample.
Nginx is a high-performance Proxy and Load Balancer application used by a wide range of people.
Just Hint: besides UDP and TCP support, Nginx also supports higher-level load balancing like gRPC in HTTP v2.
Nginx will be used as Load Balancer. The following configuration will be mounted as Kubernetes ConfigMap on Nginx Kubernetes Deployment.
In this configuration, assume that you have three Kubernetes Node. If you implement your own session distribution, then you can distribute without a backup option in this configuration.
In this section, all configurations will be turned into Kubernetes YAMLs. We will repeat, but we will have to convert the above configurations by fitting the Kubernetes structure for ease of deployment. Janus Gateway and Coturn servers will be deployed as Kubernetes Daemonset and Nginx will be deployed as Kubernetes Deployment. Every Kubernetes Deployment and Kubernetes Daemonset has “not-ready” and “unreachable” toleration will be 0 to Kubernetes react fast as possible.
Important Note: STUN will be used in this deployment. If your service will be served over NAT or a Firewall, you should use TURN server instead.
Janus Gateway Deployment
After applying these YAMLs with kubectl, we are done :)
Be careful about the installation sequence. The following sequence will be just fine.
2- Janus Gateway
This deployment provides us an Active-Passive Highly Available Janus Gateway cluster. With the help of Nginx Load Balancer, you can apply Active-Passive architectures to all your other applications using this methodology.