How does DNS work for Services and pods in Kubernetes?
IntermediateConceptKubernetes, Containers, MTU & Performance Basics
Answer
CoreDNS serves the cluster.local zone. A Service web in namespace shop resolves as web.shop.svc.cluster.local; from the same namespace just web. Headless services return A records for each ready pod, and StatefulSet pods get stable names like db-0.db.shop.svc.cluster.local.
kubectl exec -it pod -- nslookup web.shop
kubectl -n kube-system logs deploy/coredns
More on Kubernetes, Containers, MTU & Performance Basics
What are the basic Kubernetes networking rules?BeginnerWhat are the Service types in Kubernetes?BeginnerWhat is the difference between a Service and an Ingress?BeginnerHow does kube-proxy implement Services?AdvancedWhat is a CNI plugin and how do the main ones differ?IntermediateWhat are the trade-offs of AWS VPC CNI?Advanced