Understanding the Different Types of Kubernetes Network Models

Roman Glushach
7 min readAug 25, 2023

--

Kubernetes Network Models

Modern computer networks are sophisticated systems that require a multitude of physical and logical resources to function optimally. At the heart of these networks lies the core network, which comprises various physical devices known as appliances. These devices are responsible for directing network traffic and ensuring efficient data transfer between different points within the network.

Several crucial networking protocols operate in the context of the core network. These protocols are essential for facilitating data transmission and are primarily associated with the lower layers of the Open Systems Interconnection (OSI) model.

Some notable examples include:

  • Data Link Layer (L2): Point-to-Point Protocol (PPP), Address Resolution Protocol (ARP)
  • Network Layer (L3): Internet Protocol version 4 and 6 (IPv4, IPv6), Internet Control Message Protocol (ICMP)
  • Transport Layer (L4): Transmission Control Protocol (TCP), User Datagram Protocol (UDP)

Above the core network, numerous servers work together to provide data and services. These services rely on additional networking protocols that focus on processing and interpreting data once it reaches its intended destination. These protocols belong to the higher layers of the OSI model, also referred to as the software layers: session, presentation, and application layers.

Familiar examples of such protocols include:

  • Hypertext Transfer Protocol (HTTP)
  • File Transfer Protocol (FTP)
  • Simple Mail Transfer Protocol (SMTP)

It is important to note that understanding the interplay between these various networking protocols and layers is crucial for designing, implementing, and maintaining modern computer networks.

By comprehending the relationships between the physical appliances, networking protocols, and software layers, administrators can create robust, efficient, and secure network infrastructures that support a wide range of applications and services.

Traditional Networking Models

Traditional networking models are based on the concept of

  • Network Address Translation (NAT): technique that allows multiple devices to share a single public IP address, by mapping their private IP addresses to different ports on the public IP address
  • Subnetting: technique that divides a network into smaller segments, each with its own range of IP addresses and network settings

These techniques are useful for managing network traffic and security, but they also introduce some limitations for containerized environments:

  • Port exhaustion: Since NAT relies on port mapping, it can run out of available ports when there are too many containers sharing the same public IP address. This can limit the scalability of containerized applications and cause network failures
  • IP address management: Since subnetting assigns a fixed range of IP addresses to each network segment, it can be difficult to manage the IP address allocation for containers, especially when they are dynamically created and deleted. This can result in IP address conflicts or waste of IP address space
  • Network configuration: Since traditional networking models require manual configuration of network settings, such as routing tables, firewall rules, or load balancers, it can be complex and error-prone to maintain the network configuration for containers, especially when they are distributed across different nodes or networks

While traditional networking models work well for physical machines, they face significant challenges in containerized environments. Containers are ephemeral and can be spun up or down quickly, making it difficult to maintain static IP addresses and routing tables. Additionally, containers may need to communicate with other containers running on different hosts, which complicates network configuration and management.

Kubernetes Networking

Kubernetes networking differs from traditional networking in several ways. Kubernetes networking is based on the following principles:

  • Flat network: Kubernetes assumes that every pod (a group of one or more containers) has a unique IP address that is routable within the cluster. This means that there is no need for NAT or subnetting, and pods can communicate with each other directly without any intermediaries
  • Service abstraction: Kubernetes provides a service abstraction that allows pods to expose their functionality to other pods or external clients. A service is a logical grouping of pods that provide the same functionality, and it has a stable name and IP address that does not change even if the underlying pods change. A service can also act as a load balancer that distributes the traffic among the pods that belong to it
  • Network policies: Kubernetes allows users to define network policies that specify which pods can communicate with which other pods or services. Network policies can be used to enforce security rules or isolation policies for different groups of pods within the cluster

Kubernetes Network Models

Bridge Network Model

The bridge network model uses a dedicated bridge interface for each pod to connect it to the cluster’s networking infrastructure. This allows pods to communicate directly with each other using their own IP addresses. The bridge interface is created automatically when a pod is created, and it is managed by Kubernetes.

Host Network Model

In the host network model, pods share the same network namespace as the host machine. Each pod gets its own IP address within the host’s subnet, allowing them to communicate directly with the host and other pods on the same host. No additional bridging or routing components are needed, making this model lightweight and easy to manage.

Overlay Network Model

Overlay Network Model

The overlay network model creates a virtualized network overlay that spans across all nodes in the cluster. It uses software-defined networking techniques to encapsulate traffic between pods and route it through the overlay. This decouples the pods from the underlying physical network and enables more advanced networking features like service discovery and load balancing.

Overlay networks are software-driven systems that transport network traffic over an underlay network, abstracting the low-level details of traffic forwarding. This allows for the implementation of virtual networks, which are an abstraction of the resources provided by the underlying network. This means that the same physical infrastructure can be used to create multiple virtual networks without changing the underlay network.

Overlay networks allow operators and managers to use the same network infrastructure to create multiple logical networks or even a virtual network over the Internet, connecting devices deployed in different physical networks.

There are several protocols used for data transportation in overlay networks, including layer 2 and layer 3 tunneling protocols:

  • VXLAN: for virtual data link connectivity over physical network layer
  • GRE: for point-to-point communication between hosts in public network
  • IPSec: for securing communications in overlay network, enabling data authentication, confidentiality, and integrity

These protocols allow for the creation of different types of virtual networks, such as Virtual Private Networks (VPN) and Virtual Local Area Networks (VLAN). Since overlay networks are software-based, they are more flexible than hardware alternatives, making it easier to alter the abstract network topology of a virtual network.

However, virtual networks may impose additional processes such as encapsulation and cryptography, which can increase latency and decrease throughput in a networked system.

Underlay Network Model

Underlay Network Model

The underlay network model is similar to the overlay model but optimizes latency-sensitive applications by avoiding unnecessary hops. Instead of sending packets through an overlay tunnel, the undelay model sends them directly from the source pod to the destination pod using a direct path. This model requires specialized hardware support and is typically used for real-time workloads.

The underlay network refers to the physical infrastructure that enables the transmission of data from one point to another. This includes devices such as switches, routers, and cable plant infrastructure, which make up the network topology.
The underlay network operates at the first 3 layers of the OSI model: physical, data link, and network. The 4th layer, transport, can also be considered part of the underlay network as it serves as a transition between the underlay and overlay networks.

One challenge with the underlay network is its limited mobility and scalability due to its reliance on hardware. However, new networking paradigms such as Network Function Virtualization and Software-Defined Networks aim to move the underlay network from a hardware plane to a software plane, increasing its flexibility. Protocols that enable underlay networking are mostly related to ethernet switching, routing.

Summary of Common Network Models

List of Network Models

Conclusion

There is no one-size-fits-all solution for Kubernetes networking, as each approach has its own trade-offs and considerations. The choice of the network model depends on various factors, such as the size and complexity of the cluster, the performance and security requirements of the applications, and the characteristics and constraints of the underlying network infrastructure. Therefore, it is important to evaluate and compare the different options and select the one that best suits your needs and preferences.

--

--

Roman Glushach
Roman Glushach

Written by Roman Glushach

Senior Software Architect & Engineer Manager at Freelance

No responses yet