Room 19
DNS & SERVICE DISCOVERY
The Signal Tower
- Every Service gets a DNS name in Kubernetes, powered by CoreDNS.
- A chain of services have been deployed - follow the DNS trail to find the hidden password.
📜 Mission Briefing
- Examine the CoreDNS deployment:
kubectl get pods -n kube-system -l k8s-app=kube-dns. - View the CoreDNS ConfigMap:
kubectl get cm coredns -n kube-system -o yaml. - Three services have been deployed:
svc-alpha,svc-beta,svc-gammain namespacedns-trail. - From a test pod, resolve each service’s FQDN:
- Curl
svc-gamma.dns-trail- it returns the password. - The password is
coredns42.
Key Commands
| Command | Purpose |
|---|---|
kubectl get svc -n kube-system |
CoreDNS service |
kubectl get cm coredns -n kube-system -o yaml |
CoreDNS config |
kubectl run test --image=busybox --rm -it -- nslookup SVC |
DNS resolution |
kubectl exec POD -- cat /etc/resolv.conf |
Pod DNS config |
How DNS Works in Kubernetes
# Service DNS format:
# <service>.<namespace>.svc.cluster.local
#
# Pod DNS format (for StatefulSets):
# <pod-name>.<service>.<namespace>.svc.cluster.local
# Short forms (within same namespace):
# <service> → my-service
# <service>.<namespace> → my-service.production
# <service>.<namespace>.svc → my-service.production.svc
# DNS resolution from a pod
kubectl run dns-test --image=busybox:1.36 --rm -it --restart=Never -- \
nslookup kubernetes.default.svc.cluster.local
# Check pod's DNS configuration
kubectl exec my-pod -- cat /etc/resolv.conf
# nameserver 10.96.0.10
# search default.svc.cluster.local svc.cluster.local cluster.local
# CoreDNS Corefile (configuration)
kubectl get cm coredns -n kube-system -o yaml
# .:53 {
# kubernetes cluster.local in-addr.arpa ip6.arpa {
# pods insecure
# fallthrough in-addr.arpa ip6.arpa
# }
# forward . /etc/resolv.conf
# cache 30
# loop
# reload
# loadbalance
# }
# Headless services (ClusterIP: None) return pod IPs directly
# Used with StatefulSets for stable DNS names per pod
Hints
Hint 1
Create a test pod for DNS lookups:
Hint 2
Or use wget directly:
Hint 3
The password is coredns42.