External-to-service communication
In addition to routing traffic within a cluster, Kubernetes also allows you to expose an application to an external network. There are two main ways to do this:
- Egress: This functionality enables you to direct traffic from your Kubernetes Services to the internet. It leverages iptables to execute source NAT, thereby making it seem like the traffic originates from the node rather than the Pod.
- Ingress: This functionality facilitates the management of incoming traffic from external sources to Services. It also provides the ability to regulate access to Services through connection rules. Normally, two separate ingress solutions operate in distinct network stack regions: the service load balancer and the ingress controller.
The following diagram shows the ingress and egress functionality:
Figure 4.15 – Ingress and egress
These are the main way to expose your services to an external network, but it...