External-to-internal communication

To publish applications in Kubernetes, we can leverage either Kubernetes Service, with type NodePort or LoadBalancer, or Kubernetes Ingress. For NodePort service, as introduced in previous section, the port number of the node will be a pair with the Service. Like the following diagram, port 30361 on both node 1 and node 2 points to Service A, which dispatch the traffics to Pod1 and a Pod with static probability.

LoadBalancer Service, as you may have learned from the recipe Working with Services in Chapter 2, Walking through Kubernetes Concepts, includes the configurations of NodePort. Moreover, a LoadBalancer Service can work with an external load balancer, providing users with the functionality to integrate load balancing procedures between cloud infrastructure and Kubernetes resource, such as the settings healthCheckNodePort and externalTrafficPolicy. Service B in the following image is a LoadBalancer Service. Internally, Service B works the same as Service A, relying on iptables to redirect packets to Pod; Externally, cloud load balancer doesn't realize Pod or container, it only dispatches the traffic by the number of nodes. No matter which node is chosen to get the request, it would still be able to pass packets to the right Pod:

Kubernetes Services with type NodePort and type LoadBalancer
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.156.251