Study guide

7.1 Kubernetes Networking, Services & Ingress

Kubernetes and Cloud Native Associate KCNA

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Introduction & Exam Overview

1.1 About the KCNA Exam & Certification Path 1.2 How to Use This Study Guide

2 Chapter 2: Kubernetes Fundamentals - Cluster Architecture & the API

2.1 Kubernetes Architecture & Control Plane Components 2.2 Worker Node Architecture & Node Components 2.3 Kubernetes API, Declarative Management & kubectl 2.4 Kubernetes Releases, API Versioning & Deprecation Policy

3 Chapter 3: Kubernetes Fundamentals - Workloads & Configuration

3.1 Core Workload Objects (Pods, Deployments & ReplicaSets) 3.2 Advanced Controllers (StatefulSets, DaemonSets, Jobs & CronJobs) 3.3 Namespaces, Labels, Selectors & Annotations 3.4 ConfigMaps, Secrets & Application Configuration 3.5 Pod & Container Lifecycle, Restart Policies & Graceful Termination

4 Chapter 4: Kubernetes Fundamentals - Scheduling & Autoscaling

4.1 Scheduling, Resource Management & Node Selection 4.2 Advanced Scheduling: Affinity, Topology Spread, Priority & Disruption Budgets 4.3 Autoscaling Workloads & Clusters (HPA, VPA, Cluster Autoscaler, KEDA)

5 Chapter 5: Kubernetes Fundamentals - Cluster Administration & Extensibility

5.1 Kubernetes Distributions, Installation Tools & Managed Services 5.2 Cluster Administration: Node Maintenance, Upgrades & etcd Backup 5.3 Extending Kubernetes: CRDs, Operators & the Controller Pattern

6 Chapter 6: Kubernetes Fundamentals - Containerization

6.1 Container Fundamentals, Runtimes & Registries 6.2 Container Image Anatomy: Layers, Tags, Digests & Pull Policy

7 Chapter 7: Container Orchestration - Networking & Service Discovery

7.1 Kubernetes Networking, Services & Ingress 7.2 Cluster DNS & Service Discovery with CoreDNS 7.3 NetworkPolicies, Zero-Trust Segmentation & the Gateway API

8 Chapter 8: Container Orchestration - Storage

8.1 Storage Concepts (PVs, PVCs, StorageClasses & CSI) 8.2 Volume Types, Snapshots & Stateful Storage Operations

9 Chapter 9: Container Orchestration - Security

9.1 Kubernetes Security & Access Control (RBAC & ServiceAccounts) 9.2 The 4C's of Cloud Native Security & Supply-Chain Trust 9.3 Service Mesh, mTLS & Zero-Trust Service Identity

10 Chapter 10: Container Orchestration - Troubleshooting

10.1 Container Troubleshooting & Health Probes 10.2 Cluster & Node-Level Troubleshooting

11 Chapter 11: Cloud Native Application Delivery

11.1 Cloud Native CI/CD Pipelines & Build Tooling 11.2 GitOps & Package Management (Helm, Kustomize, Argo CD & Flux) 11.3 Deployment Strategies & Release Management 11.4 Progressive Delivery Automation: Argo Rollouts, Flagger & Feature Flags 11.5 Application Debugging & Developer Workflows in Kubernetes 11.6 Platform Engineering & Developer Self-Service

12 Chapter 12: Cloud Native Architecture - Observability & Principles

12.1 Cloud Native Observability (Logging, Metrics & Tracing) 12.2 Cloud Native Principles & Architecture Patterns 12.3 Serverless, FaaS & Event-Driven Architecture

13 Chapter 13: Cloud Native Architecture - CNCF Ecosystem & Community

13.1 The CNCF Landscape, Governance & Project Lifecycle 13.2 Cloud Native Community, Collaboration & Contribution

7.1 Kubernetes Networking, Services & Ingress

Key Takeaways Explain This Topic AI

Kubernetes mandates a flat, IP-per-Pod networking model where every Pod receives a unique IP address and can communicate with any other Pod without NAT.

Container Network Interface (CNI) plugins (such as Calico, Cilium, and Flannel) implement the networking data plane and enforce security policies using overlays, BGP, or eBPF.

Services provide stable Layer 4 networking abstractions across dynamic Pod IPs through four types: ClusterIP (internal), NodePort (static node port), LoadBalancer (cloud provider LB), and ExternalName (DNS alias).

Ingress controllers provide Layer 7 HTTP/HTTPS routing, host- and path-based routing, and TLS termination based on declarative Ingress API resources.

NetworkPolicies enforce declarative Layer 3/4 firewall rules using namespace and pod selectors, providing Zero Trust micro-segmentation when backed by a policy-enforcing CNI.

Last updated: August 2026

7.1 Kubernetes Networking, Services & Ingress

Quick Answer: Kubernetes enforces a flat, IP-per-Pod networking model where every Pod gets a unique IP address and can communicate with all other Pods without Network Address Translation (NAT). Container Network Interface (CNI) plugins like Calico, Cilium, and Flannel implement this network fabric. Services provide stable Layer 4 virtual IPs across ephemeral Pods (ClusterIP, NodePort, LoadBalancer, ExternalName), while Ingress resources deliver Layer 7 HTTP routing and TLS termination. NetworkPolicies apply granular, Zero Trust firewall rules using Pod and Namespace selectors.

Networking in Kubernetes is fundamentally designed to support microservice architectures by treating containers as first-class network entities. Unlike traditional container platforms that rely on port mapping and host-level NAT, Kubernetes establishes strict networking invariants that ensure seamless inter-pod communication while abstracting underlying infrastructure complexities.

The Kubernetes Pod-to-Pod Networking Model

The core philosophy of Kubernetes networking is built around the IP-per-Pod model . Every Pod in a cluster receives its own unique IP address from a dedicated Pod CIDR block assigned to its host node. This design eliminates the need to manage container-to-host port mappings.

Kubernetes imposes three mandatory networking requirements on every cluster implementation:

Pod-to-Pod Communication: All Pods can communicate with every other Pod on any node without using Network Address Translation (NAT).

Node-to-Pod Communication: All agents on a host node (such as the kubelet and kube-proxy ) can communicate with all Pods running on that same node.

Self-Identification: The IP address that a Pod sees as its own IP is identical to the IP address that every other Pod and node sees it as.

This flat network topology greatly simplifies application port allocation, service discovery, and container migration across nodes. However, Kubernetes does not provide a default built-in implementation for this network topology; instead, it delegates network provisioning to CNI plugins.

Container Network Interface (CNI) Plugins

The Container Network Interface (CNI) is a CNCF project that defines a standardized specification and set of libraries for configuring network interfaces in Linux containers. When a container runtime (such as containerd or CRI-O ) creates a Pod sandbox, it invokes the configured CNI plugin to attach network interfaces, allocate IP addresses via IPAM (IP Address Management), and set up routing tables.

Different CNI plugins utilize distinct underlying technologies to establish flat Pod networks and enforce network security:

CNI Plugin Primary Dataplane Technology Policy Support eBPF Capabilities Primary Use Case

Flannel Overlay (VXLAN, UDP, host-gw) No No Simple, lightweight development clusters requiring basic layer-3 connectivity without network isolation.

Calico BGP Routed or Overlay (VXLAN / IP-in-IP) Yes Yes (Optional) Enterprise production clusters needing high performance, flexible routing architectures, and rich NetworkPolicy enforcement.

Cilium eBPF (Extended Berkeley Packet Filter) Yes Native High-performance, large-scale cloud-native clusters requiring L3-L7 security policies, deep observability (Hubble), and iptables bypass.

Overlay Networks vs. BGP Routing

Overlay Networks (e.g., VXLAN): Encapsulate Pod network packets inside standard UDP packets to cross underlying host networks. Easy to configure across cloud providers but incurs a slight CPU/packet overhead due to encapsulation.

BGP Routed Networks: Route Pod IP traffic directly over the physical network fabric using Border Gateway Protocol (BGP). Eliminates encapsulation overhead for bare-metal and high-throughput environments.

Kubernetes Service Types (Layer 4 Abstractions)

Because Pods are ephemeral objects with dynamic IP addresses that change upon restart or rescheduling, applications cannot rely on static Pod IPs for communication. A Service is an abstract Kubernetes API resource that defines a logical set of Pods (selected via spec.selector ) and a stable policy by which to access them (via a Virtual IP and DNS name).

kube-proxy runs on every node and updates host iptables or IPVS rules to load-balance traffic sent to a Service's Virtual IP across healthy backing Pod endpoints.

Kubernetes offers four primary Service types:

Service Type Scope & Routing Mechanism Typical Use Case

ClusterIP Exposes the Service on an internal cluster IP address. Only reachable from within the cluster. (Default type) Inter-microservice communication, internal databases, microservice-to-microservice APIs.

NodePort Exposes the Service on each Node's IP at a static port (in the range 30000–32767). Automatically routes to an internal ClusterIP. Development access, legacy external load balancers, or directly exposing a service on host ports.

LoadBalancer Exposes the Service externally using a cloud provider's load balancer (e.g., AWS NLB, GCP CLB). Automatically creates NodePort and ClusterIP routes. Production web applications requiring public IPv4/IPv6 Internet ingress with cloud provider integration.

ExternalName Maps a Service to an external DNS CNAME record (e.g., db.example.com ). Does not use selectors or proxies. Aliasing external databases or third-party services outside the Kubernetes cluster.

  • Service Manifest Example apiVersion: v1
  • kind: Service

metadata:

  • name: payment-service
  • namespace: finance

spec:

type: ClusterIP

selector:

app: payment-api

ports:

  • name: http
  • protocol: TCP
  • port: 80
  • targetPort: 8080
  • Ingress Controllers & Ingress Resources (Layer 7 Routing)

While a LoadBalancer Service operates at Layer 4 (TCP/UDP) , creating a separate cloud load balancer for every microservice can quickly become expensive and unmanageable. An Ingress resource manages external HTTP and HTTPS traffic to services within a cluster at Layer 7 (Application Layer) .

It is crucial to distinguish between an Ingress Resource and an Ingress Controller:

Ingress Resource: A YAML manifest defining HTTP routing rules, hostnames, path prefixes, and TLS configurations.

Ingress Controller: A daemon (such as NGINX Ingress Controller, Traefik, or Contour) that watches the Kubernetes API server for Ingress resources and dynamically configures reverse proxy software to enforce those rules.

  • Feature Layer 4 Service (LoadBalancer) Layer 7 Ingress
  • OSI Layer Transport Layer (TCP/UDP ports) Application Layer (HTTP/HTTPS URIs)
  • Routing Basis IP address and Port number Hostnames ( api.example.com ) and Paths ( /v1/auth )
  • TLS Termination Handled at destination or external load balancer Handled centrally at the Ingress controller

Cost Efficiency High (Requires 1 Cloud LB per Service) Low (Single Cloud LB routes to dozens of internal Services)

  • Ingress Manifest Example apiVersion: networking.k8s.io/v1
  • kind: Ingress

metadata:

name: web-ingress

annotations:

nginx.ingress.kubernetes.io/rewrite-target: /

spec:

tls:

- hosts:

  • app.example.com
  • secretName: app-tls-cert

rules:

- host: app.example.com

http:

paths:

  • path: /billing
  • pathType: Prefix

backend:

service:

name: billing-service

port:

  • number: 80
  • NetworkPolicies & Zero Trust Micro-Segmentation

By default, Kubernetes network traffic is unrestricted : any Pod in any namespace can send network packets to any other Pod. To establish a Zero Trust security posture, operators deploy NetworkPolicies .

A NetworkPolicy specifies how groups of Pods are allowed to communicate with each other and with other network endpoints. NetworkPolicies use podSelector , namespaceSelector , and ipBlock rules to filter traffic based on:

Ingress: Incoming connections to target Pods.

Egress: Outgoing connections originating from target Pods.

Crucial Exam Distinction: NetworkPolicy objects are native Kubernetes API resources, but Kubernetes itself does not enforce them. A CNI plugin with policy enforcement capabilities (such as Calico or Cilium) must be installed. If a cluster uses a basic CNI like Flannel without policy support, NetworkPolicy manifests will be silently ignored by the network data plane.

Default-Deny Isolation Strategy

A cloud-native security best practice is to enforce an explicit Default Deny policy across all namespaces, blocking ingress and egress unless a later rule explicitly permits it. Because NetworkPolicy contains allow rules only — the API has no deny rule — default-deny is the mechanism that makes segmentation possible at all. Section 7.3 covers the isolation semantics, selector logic, the DNS egress trap, and the Gateway API in full.

Key Takeaways

Flat Networking: Every Pod receives a unique IP; Pod-to-Pod traffic traverses the network without NAT.

CNIs: Plugins like Calico (BGP/VXLAN), Cilium (eBPF), and Flannel (VXLAN overlay) configure container interfaces and policy enforcement.

Services (L4): Provide stable Virtual IPs and DNS aliases across dynamic Pods via ClusterIP, NodePort, LoadBalancer, and ExternalName.

Ingress (L7): Manages HTTP/HTTPS host- and path-based routing and centralizes TLS termination using an Ingress Controller.

NetworkPolicies: Enforce declarative firewall rules based on labels and CIDRs, requiring a policy-aware CNI plugin for enforcement.