Network
In a kubernetes cluster, we can think of three types of communication
- outside -> kubernetes
- within kubernetes
- kubernetes -> outside
In kubernetes, distinct conatiners are often assigned a same port.
Previously, we could use mapped ports, but often containers are recreated often, and these mappings are determined at run-time. Thus this approach has a limit that these dynamic ports must be determined in advance.
In kubernetes, we have a conceptual level (or API) called network. There are also inbound and outbound networks. The network call can be done via selector, and this network API chooses a node where its label matches the selctor.
To illustrate, the inbound network can act as a reverse proxy, which sends information to the internal kubernetes network, which then assigns which node to communicate to.