DNS & Service Discovery
HAR, Service, ko, EK, AUTOMATIC, DNS, entry, milta hai — "my-service" naam, ki, Service, "my-service.my-namespace.svc.cluster.local" se, ACCESSIBLE, ho, jaati hai, aur, SAME, namespace, ke, ANDAR, sirf, "my-service" naam, se, hi.
YE, AUTOMATIC, SERVICE, DISCOVERY, DEVELOPERS, ko, CODE, mein, HARDCODED, IPs, ki, ZAROORAT, se, BACHATA, hai — bas, Service, NAAM, use, karo, DNS, resolution, KHUD, handle, ho, jaata hai.
# Same namespace ke andar se
curl http://my-service
# Different namespace se
curl http://my-service.other-namespace.svc.cluster.local- Har Service ko automatic DNS entry milta hai — naam se hi access
- Same namespace se sirf naam, different namespace se full path chahiye
- CoreDNS Kubernetes ka default DNS server hai
Individual, pods, ko, bhi, DNS, records, mil, sakte, HAIN, (agar, StatefulSet, ke, saath, headless, service, use, ki, jaaye) — normal, Deployment, pods, ko, DIRECTLY, DNS, entry, NAHI, milti, sirf, Service, ko, milti, hai.
Kubernetes, DNS, SRV, records, bhi, provide, karta hai, JO, Service, ke, PORT, NAMES, aur, NUMBERS, ki, INFO, deta hai — ADVANCED, use-cases, mein, useful, hai, jahaan, port, DYNAMICALLY, DISCOVER, karna, ZAROORI, ho.
nslookup -type=SRV _http._tcp.my-service.default.svc.cluster.local