Module 3: Networking & Discovery
🏗️ 1. The Manual Task: Static Service Discovery
In a traditional setup, services are identified by their static IP addresses or hardcoded entries in /etc/hosts.
The Problem:
- Ephemeral IPs: Pods die and restart with new IPs.
- Manual Toil: Updating the IPs of 50 backend pods in the frontend configuration manually every time they restart is impossible.
🌐 2. The Kubernetes Abstraction: Services & CoreDNS
A Service acts as a stable virtual IP (ClusterIP) for a set of Pods.
- Stable Virtual IP: The IP address of the Service remains constant even if backend Pods change IPs.
- Label Selectors: The Service automatically finds Pods that match specific labels (
app: backend). - Integrated DNS: Kubernetes automatically creates a DNS record (
http://backend-service) that resolves to the ClusterIP. - kube-proxy: The local node service that routes traffic from the virtual IP to the healthy backend Pods.