Kubernetes Network Traffic Flow

Featured image



Overview

Understanding Kubernetes network traffic flow is crucial for both CSP (Cloud Service Provider) and on-premise environments.


Network Environments Traffic Flow

CSP Environment Traffic Flow

CSP Environment Traffic Flow


On-premise Environment Traffic Flow

On-premise Environment Traffic Flow


Ingress Controllers in CSP Environments

In CSP environments, ingress controllers are often integrated with load balancer services from cloud providers.

When the ingress controller service type is set to LoadBalancer, the cloud provider automatically assigns an external IP address (usually a public IP), which becomes the IP address of the cloud load balancer.

Through this allocated IP address, external traffic is routed to the ingress controller through the cloud load balancer, and finally delivered to the appropriate path.

I describe the relationship between an ingress controller and a load balancer controller in a cloud service provider (CSP) environment.

  1. Ingress Controller
    • The ingress controller is software that runs within the Kubernetes cluster. Observe the ingress resource and implement the routing rules defined in this resource.
    • The ingress controller serves to deliver traffic to appropriate services and pads.
  2. Load Balancer Controller
    • In a cloud environment, load balancer controllers are usually separate services managed by cloud providers.
    • The service serves to route external traffic to the Kubernetes cluster.
  3. Integration operations
    • When a Kubernetes service is created as a LoadBalancer type (for example, for an ingress controller), the cloud provider automatically allocates an external IP address and configures a load balancer.
    • This load balancer takes external traffic and passes it to the ingress controller. The ingress controller then routes the traffic to the appropriate service or pad within the Kubernetes.
  4. CSP environment features
    • In CSP environments, the ingress controller and load balancer are typically tightly integrated, and users do not need to manage the load balancer separately.
    • Instead, by configuring Kubernetes services and defining ingress resources, you can automatically take advantage of the cloud provider’s load balancing capabilities.


Conclusion
  • In conclusion, the ingress controller in CSP is tightly integrated with the cloud provider's load balancer, which enables efficient routing of external traffic to the appropriate service or path within the cluster.


Ingress Controllers in On-premise Environments



MetalLB(Onpremise LoadBalancer)


MetalLB is a solution designed to support the LoadBalancer service type in the on-premises Kubernetes cluster. In general, the load balancer function provided in the cloud environment can be used in the on-premises environment.

If you specify an IP address pool in the MetalLB setting, MetalLB dynamically allocates an IP address from this pool to provide the IP address to Kubernetes' LoadBalancer type service.

The IP address allocated in this way is used as an access point to the Kubernetes cluster from the outside.

For example, in a Metal LB setting, you can specify an IP address range as follows.

apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: example-pool
spec:
  addresses:
  - 192.168.1.100-192.168.1.150



Component Communication (Container, Pod, Service)

Kubernetes networking is designed to allow various types of entities within Kubernetes to communicate.


Container-to-Container


Pod-to-Pod


Pod-to-Service


In Kubernetes, a service provides a stable interface for pods. The service mediates requests for a specific set of pods and routes traffic to an appropriate pad.

Each service has a unique IP address called ClusterIP, which keeps the service stable.


Pod-to-Service


Internet-to-Service

Internet-to-Service


Network Components Table

🔧 Component 📄 Purpose 📡 Communication Type
🛠️ Container Application runtime localhost
📦 Pod Basic scheduling unit Pod IP
🖥️ Service Stable endpoint ClusterIP
🌐 Ingress External access LoadBalancer/NodePort

Key Network Features

  • Pod Networking - Flat network space
    - No NAT between pods
    - Unique IP per pod
  • Service Networking - Stable endpoints
    - Load balancing
    - Service discovery
  • External Access - Ingress controllers
    - Load balancers
    - NodePorts



Reference