Kubernetes Networking
Kubernetes networking provides pod-to-pod connectivity, service discovery, load balancing, and ingress routing within and across clusters. Every pod gets its own IP, services provide stable endpoints, and network policies control which workloads can communicate.
itCloud native tools and technologies | OpenSkills.info
Recommended first:kubernetes-fundamentals
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic: Kubernetes Networking
Kubernetes networking gives moving containers a way to find and reach one another without making every application memorize an address book that expires whenever a Pod is replaced. Every Pod is a small host with its own cluster-wide IP. Containers inside one Pod share that network space and use localhost. The cluster is deliberately flat, which is pleasant right up until it becomes a security meeting.
The first useful idea is that Pod IPs are not names. Pods scale, roll out, and disappear, so an address is a poor place to build a relationship. A Service supplies the stable identity: a virtual IP and DNS name for the Pods currently selected by labels. Kubernetes tracks those current backends in EndpointSlices, while a service proxy sends the traffic along. The machinery is busy, but the instruction to an application remains blessedly dull: call the Service name.
The second idea is that the flat network is a contract, not a tiny miracle inside the API server. A network plugin, often called a CNI, provides Pod addresses, routing, and usually policy enforcement. Kubernetes describes the desired shape. The plugin must make packets obey it. That distinction matters when a policy looks excellent on paper and has not altered a single packet, which is a very expensive form of stationery.
For traffic from outside the cluster, a Gateway API configuration divides the work: GatewayClass names the infrastructure, Gateway provides listeners, and Routes describe application traffic. Ingress still handles established HTTP routing, but new features go to Gateway API. Neither object is a door by itself. A controller must be present to turn the route into a working entry point.
Then comes the correction to cheerful flatness: NetworkPolicy selects Pods and allows the ingress and egress they need. Pods are non-isolated until a policy selects them. Once selected, omitted flows are blocked in that direction. DNS is one of those flows, so a default-deny policy can make a perfectly healthy application appear to have forgotten its own name.
Read the cheatsheet when you need the map of Services, DNS, Gateway, and policy behavior. Use the practice reference to test the layers in a disposable namespace. The exercise turns the model into observable failures and successes. The links tab holds the official detail for the point where the map becomes your production route table.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://kubernetes.io/docs/concepts/services-networking/
Supports
- Network model — per-Pod cluster-wide IPs, shared namespace within a Pod, localhost between containers
- All-Pods-to-all-Pods communication without NAT; node agents reach node-local Pods
- Service API purpose; automatically managed EndpointSlices; service proxy programming the data plane
- Gateway API and Ingress for external traffic; NetworkPolicy for segmentation; cluster DNS
- https://kubernetes.io/docs/concepts/services-networking/service/
Supports
- Service selectors, virtual IPs, port vs targetPort vs nodePort
- Service types — ClusterIP, NodePort, LoadBalancer, ExternalName; headless Services
- Selector-less Services with manual endpoints
- externalTrafficPolicy behavior
- https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/
Supports
- EndpointSlice objects tracking current Service backends
- https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
Supports
- Service DNS naming scheme <svc>.<ns>.svc.<cluster-domain>; cluster.local default
- Headless Service and StatefulSet per-Pod DNS records; SRV records
- https://kubernetes.io/docs/concepts/services-networking/ingress/
Supports
- Host/path-based routing, TLS termination, ingressClassName, default backend
- Ingress requires an ingress controller to take effect
- Ingress API frozen with new features added to Gateway API
- https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/
Supports
- Ingress controllers must be deployed separately; multiple controllers and classes
- https://kubernetes.io/docs/concepts/services-networking/gateway/
Supports
- Role-oriented design — GatewayClass, Gateway, Routes and their intended owners
- Gateway API as expressive, portable successor for L4/L7 routing
- https://kubernetes.io/docs/concepts/services-networking/network-policies/
Supports
- Policy scope and rule types — podSelector, namespaceSelector, ipBlock, ports
- Isolation semantics — non-isolated until selected; additive allow-lists; per-direction
- Enforcement by the network plugin; unsupported plugins do not enforce
- Absence of deny logging and L7 rules in the core API
- https://kubernetes.io/docs/concepts/cluster-administration/addons/
Supports
- Network plugins (CNI) as installable addons implementing the network model
- https://kubernetes.io/blog/2015/07/kubernetes-v1-0-released/
Supports
- Kubernetes v1.0 release
- https://kubernetes.io/blog/2017/06/kubernetes-1-7-security-hardening-stateful-application-extensibility-updates/
Supports
- NetworkPolicy promoted to stable in Kubernetes 1.7
- https://kubernetes.io/blog/2017/10/enforcing-network-policies-in-kubernetes/
Supports
- NetworkPolicy enforcement depends on a supporting network plugin
- Egress NetworkPolicy capabilities introduced in Kubernetes 1.8
- https://kubernetes.io/blog/2020/08/26/kubernetes-release-1.19-accentuate-the-paw-sitive/
Supports
- Ingress graduated to v1 in Kubernetes 1.19
- https://kubernetes.io/blog/2020/09/02/scaling-kubernetes-networking-with-endpointslices/
Supports
- kube-proxy began reading EndpointSlices by default in Kubernetes 1.19
- EndpointSlices improved Service backend update scalability
- https://kubernetes.io/blog/2021/04/08/kubernetes-1-21-release-announcement/
Supports
- EndpointSlice graduated to stable in Kubernetes 1.21
- https://kubernetes.io/blog/2021/04/20/defining-networkpolicy-conformance-cni-providers/
Supports
- CNI implementations can differ in NetworkPolicy conformance
- Cyclonus evaluates NetworkPolicy behavior across supported constructs
- https://kubernetes.io/blog/2023/10/31/gateway-api-ga/
Supports
- Gateway, GatewayClass and HTTPRoute graduated to Gateway API v1
- https://kubernetes.io/blog/2024/05/09/gateway-api-v1-1/
Supports
- Gateway API v1.1 added stable GRPCRoute and service mesh support
- https://docs.cilium.io/en/stable/network/kubernetes/policy/
Supports
- Cilium enforces standard Kubernetes NetworkPolicy and offers additional policy resources
- Combining policy types requires care when evaluating allowed traffic
- https://doc.traefik.io/traefik/reference/install-configuration/providers/kubernetes/kubernetes-gateway/
Supports
- Traefik implements the Kubernetes Gateway API provider and supports Gateway API route resources
- https://docs.konghq.com/kubernetes-ingress-controller/latest/concepts/gateway-api/
Supports
- Kong maps Gateway API resources to managed Gateway deployments and routes traffic to Services
- https://docs.nginx.com/nginx-gateway-fabric/overview/gateway-architecture/
Supports
- NGINX Gateway Fabric implements Gateway API with NGINX as its data plane
- Its controller watches Gateway resources, Services, Endpoints and Secrets
- https://istio.io/latest/docs/tasks/traffic-management/ingress/gateway-api/
Supports
- Istio supports Kubernetes Gateway API for ingress and mesh traffic management
- Gateway API and Istio APIs have different deployment and routing models
