How do you automate DNS records for Kubernetes Ingress and Services?
IntermediateScenarioKubernetes Networking
Answer
Situation read → ExternalDNS watches resources and writes DNS records.
What I'd do →
- Install ExternalDNS with a role limited to the hosted zone
- Annotate the Service or use the Ingress host:
external-dns.alpha.kubernetes.io/hostname: app.example.com - Set
--policy=upsert-onlyand--txt-owner-id=cluster-ato protect existing records - Check
kubectl logs deploy/external-dnsanddig app.example.com - Use a dedicated subdomain zone for the cluster
Why → Records follow the lifecycle of the Kubernetes objects, preventing stale entries.
Interview tip → Say TXT ownership records stop two clusters fighting over a name.
More on Kubernetes Networking
Explain the Kubernetes networking model in one minute.BeginnerClusterIP, NodePort and LoadBalancer: when do you use each?BeginnerHow does a pod find another service by name?BeginnerService versus Ingress: what is the difference?BeginnerWhat does a CNI plugin do and which ones do you know?BeginnerHow do you reach a pod from your laptop for debugging without exposing it?Beginner