Network Connectivity in Kubernetes
Virtual networking has revolutionized the way organizations build and manage their application infrastructure. With virtual networks, administrators can create complex network topologies that are tightly coupled to their application demands without compromising scalability or manageability. In this blog post, we will explore the concept of virtual networking in Kubernetes and examine two popular logical topologies: mesh and hub-spoke.
Previously we discussed the importance of network segmentation in your cluster. In this blog we will build on that topic by demonstrating how network segment connectivity can be automated and simplified. While there are multiple topology options, network operators generally deploy one of two network patterns – fully meshed or hub-and-spoke. These topologies are found throughout all communications and transportation networks – most recognizably in the airline industry. Many complex communications architectures can be created through the combination of these two simple patterns.
Virtual Networks and Virtual Network Topologies
In the previous blog we learned to create virtual networks for any Kubernetes workloads (aka, microservices). A Virtual Network is a logical grouping of workloads which can span multiple physical hosts and geographical locations. Using routing protocols and tunneling technologies, virtual networks can interconnect virtual machines and container workloads to cloud services, resources, or other workloads.
Virtual Networks are isolated by default, but by using logical constructs like virtual network routers (VNRs) connectivity can be enabled between workloads of different virtual networks in an automated and dynamic fashion.
Behind the scenes Virtual Network Routers (VNR) perform route leaking between Virtual Networks. Route leaking establishes connectivity between Virtual Networks by importing routes and the routing tables associated with these instances. As a result, endpoints in one virtual network can access endpoints in another virtual network.
Fully Meshed Topologies
In a mesh topology, all selected endpoints are interconnected enabling bidirectional communication for any-to-any connectivity. The mesh topology provides a highly flexible and scalable way to interconnect workloads, allowing for rapid deployment and dynamic scaling of applications. It simplifies network management and reduces operational burden, while also providing reliable and fast communication between applications and workloads.
Mesh topologies are well suited for any to any communication required between networks' endpoints.
This topology is achieved by deploying a Virtual Network Router (VNR) with a "mesh" type configuration, which connects separate virtual networks and allows for full workload-to-workload communication among all the workloads of the virtual networks.
Mesh Topology Example:
Hub and Spoke Topologies
In a hub and spoke topology, bidirectional connectivity is allowed between spoke endpoints to hub endpoints. Hub virtual networks are non-transitive, where endpoints in a spoke cannot connect to endpoints in another spoke. The hub and spoke topology provides a centralized architecture for managing and distributing network traffic across hub and spoke networks.
Hub-and-spoke topologies are well suited to provide access to common services like telemetry, or any other management functions, where the hub networks provide access to common services.
To create a hub-and-spoke topology you must create at least two VNRs, one to act as the hub, and any number of spokes. A Virtual Network Router (VNR) with a 'hub' type configuration is deployed to bring together the workloads of separate virtual networks. Similarly, create Virtual Network Router (VNR) with 'spoke' type configuration to bring together the workloads of separate virtual networks in to spoke, then pair these two Virtual Network Routers to connect them together.
Hub-Spoke Topology Example:
Hybrid Topologies
In a hybrid deployment, multiple topologies are combined to create a forwarding paradigm that perfectly matches the application requirements. For example, a mesh topology may be used for core application communications with a hub-and-spoke topology used to connect subtended microservices. A hybrid topology optimizes reachability and isolation with flexibility and security.
------------------------------
Prasad Miriyala
------------------------------