cSRX Service With Load Balancing Support
Understanding cSRX as Kubernetes Service with Load Balancing Support
cSRX Pod is identified with predefined selectors and exposed with supported load balancer to distribute traffic among different cSRX Pods. The standard load balancer is ingress controller, external load balancer or cluster IP.
A Service enables network access to a set of Pods in Kubernetes. Services select Pods based on their labels. When a network request is made to the service, it selects all Pods in the cluster matching the service's selector, chooses one of them, and forwards the network request to it. A deployment is responsible for keeping a set of pods running.
Service is to group a set of Pod endpoints into a single resource. By default, clients inside the cluster can access Pods in the Service using cluster IP address. A client sends a request to the IP address, and the request is routed to one of the Pods in the Service. The types of Services are ClusterIP (default), NodePort, LoadBalancer, and ExternalName.
When you set a service’s type to NodePort, that service starts to listen on a static port on every node in the cluster. So, you can reach the service through any node’s IP address and the assigned port.
When you set a service’s type to Load Balancer, it exposes the service externally. However, to use it, you need to have an external load balancer. The external load balancer needs to be connected to the internal Kubernetes network on one end and opened to public-facing traffic on the other in order to route incoming requests.
An Ingress Controller watches for new services within the cluster and is able to dynamically create routing rules for them. An Ingress object is an independent resource, apart from Service objects, that configures external access to service’s pods. You can define the Ingress, after the Service has been deployed, to connect it to external traffic. This way You can isolate service definitions from the logic of how clients connect to them. L7 routing is one of the core features of Ingress, allowing incoming requests to be routed to the exact pods that can serve them based on HTTP characteristics such as the requested URL path. Other features include terminating TLS, using multiple domains, and load balancing traffic.
Nginx ingress controller is supported to view the traffic distribution among different cSRX Pods. For more details, see Set Up Ingress on Kubernetes Using Nginx Controller.
Configuring Ingress Service for cSRX Pods
Service is used by cSRX to connect application with cSRX Pods. cSRX Service is standard Kubernetes service, in which, the load is balanced to different cSRX Pods, and the Pods are located at different work nodes. It also monitors the backend cSRX Pod and selects working cSRX Pod according to Kubernetes Pod labels. You can use YAML file to create a cSRX service.
To create a cSRX service: