Kubernetes DNS service discovery¶
Kubernetes DNS service discovery allows applications running within a cluster to locate and connect to services using standardized naming conventions, abstracting away the underlying IP addresses which may change.^[400-devops-06-kubernetes-out-network-k8s.md]
Service Naming and Resolution¶
The cluster maintains a internal DNS search path that allows for simplified service discovery. Within a specific namespace, services can be accessed using just their service name.^[400-devops-06-kubernetes-out-network-k8s.md] For example, if a Service named external-svc exists, other Pods in the same default namespace can reach it via the hostname external-svc.^[400-devops-06-kubernetes-out-network-k8s.md]
Fully Qualified Domain Names (FQDNs) are also supported and adhere to a specific pattern: <service-name>.<namespace>.svc.cluster.local.^[400-devops-06-kubernetes-out-network-k8s.md] In the provided example, curl requests successfully resolved external-svc.default.svc.cluster.local to retrieve the correct content, confirming the default DNS suffix structure.^[400-devops-06-kubernetes-out-network-k8s.md]
Related Concepts¶
- [[Kubernetes Services]]
- [[Endpoints]]
- [[Headless Service]]
- Ingress
Sources¶
400-devops-06-kubernetes-out-network-k8s.md