The web pod asks for the address of order-svc When you create a Service, its name is registered automatically in cluster DNS (the server that turns names into IPs). In most clusters, CoreDNS does this job.
The web pod code uses only the name order-svc, not an IP. It first asks CoreDNS for that name's address.
Key idea A pod IP changes every time the pod is recreated. So you call the stable Service name instead.
A short name is tried with your own namespace appended Each pod has a list of domains to append to short names (search), and the first entry is its own namespace, shop.svc.cluster.local.
So order-svc expands to order-svc.shop.svc.cluster.local, is found on the first try, and CoreDNS returns the Service's stable address.
Key idea The full name has the form <service>.<namespace>.svc.cluster.local. cluster.local is the default domain and may differ depending on cluster settings.
The address returned is the Service virtual IP The web pod sends a request to 10.96.12.34 on port 80. This address is a virtual IP (ClusterIP) not attached to any real device.
Translation rules on every node (kube-proxy, or Cilium's eBPF implementation) intercept requests to this address.
Key idea A Service IP only has port translation rules, so it usually does not answer ping. To check connectivity, connect to the port.
The rules forward to one Ready pod The translation rules pick one pod that matches the Service selector and is Ready, and rewrite the request to that pod IP on port 8080.
The web pod never needed to know order-a's IP. Pods may change, but the name and virtual IP stay the same.
Short names do not work from another namespace The admin pod in the ops namespace calls the same short name, order-svc. The first entry in its search list is ops.svc.cluster.local.
So it looks up order-svc.ops.svc.cluster.local. No such Service exists, so it gets "name not found".
Watch out A namespace is a naming boundary. Services with the same name in shop and ops do not collide, but a short name is only looked up in your own namespace.
Include the namespace and it works from anywhere If the admin pod calls order-svc.shop or order-svc.shop.svc.cluster.local, it points exactly at the Service in shop.
CoreDNS returns the same virtual IP, and the rest of the flow matches the web pod. Traffic across namespaces is allowed by default.
A typo in the Service name means "no such name" right away If the web pod config says oder-svc by mistake, CoreDNS answers immediately that no such Service exists. The request never even reaches a Service.
App logs show a name lookup error such as "host not found" or "unknown host". This looks different from connection refused or a timeout.
If CoreDNS stops answering, every call by name stops If CoreDNS stops or traffic to DNS is blocked, every call by Service name fails. This happens even when Services and pods are healthy.
If calling by IP works but calling by name does not, suspect DNS. A common cause is the next lesson's network policy accidentally blocking DNS lookups.
Watch out In an air-gapped network, CoreDNS forwards names outside the cluster to the internal DNS. Names missing from the internal DNS cannot be resolved inside the cluster either.
Name → virtual IP → pod, in three stages CoreDNS turned the name into the Service virtual IP, and the node translation rules turned the virtual IP into a Ready pod.
Short names work only inside your own namespace. Call Services in other namespaces with the namespace appended.
Summary Use the short name in the same namespace, and name.namespace or the full name (svc.cluster.local) from another. If a name does not resolve, check the Service name, the namespace, and CoreDNS health first.