CoreDNS operations
Understand the DNS server’s responsibilities
CoreDNS is a common cluster DNS implementation. Its Kubernetes plugin watches API objects to construct records, while other plugins can handle forwarding, caching and operational signals. In many clusters CoreDNS is exposed through a Service named kube-dns in kube-system; names and deployment topology are not universal. Managed clusters may restrict configuration changes. DNS is a critical dependency, so start with read-only checks and use a reviewed rollback plan before a change.
Read the Corefile as configuration
A Corefile defines server blocks and enabled plugins. The example listens for DNS on port 53 for the root zone; the Kubernetes plugin serves the fictional cluster zone and reverse zones. The configured reverse-zone fallthrough allows unmatched reverse queries to continue. The forward plugin provides upstream resolution; the example uses a documentation-only address, so it is intentionally unsuitable for deployment. Cache limits and TTL behavior depend on plugin configuration and returned records. Plugin execution ordering is determined by the CoreDNS build, not arbitrary line rearrangement. Verify actual binary and supported plugins before applying any configuration.
.:53 { errors health ready kubernetes cluster.test in-addr.arpa ip6.arpa { fallthrough in-addr.arpa ip6.arpa } prometheus :9153 forward . 192.0.2.53 cache 30 reload loop}Know what each operational signal means
The health plugin provides process health reporting, whereas ready aggregates readiness of participating plugins according to its configured mode. Neither proves a specific client can resolve and use a Service. The prometheus plugin exposes metrics when enabled; inspect response-code counts, request rates and latency, with version-specific metric names and labels. Compare internal and external queries and check whether errors affect one namespace or many. Cache may retain negative answers until expiry, so a newly created Service may not immediately resolve for every client.
Investigate a synthetic SERVFAIL event
If an internal name fails during startup, examine readiness and API synchronization logs; CoreDNS can return SERVFAIL for Kubernetes records it has not synchronized. If internal lookups work but external names fail, inspect upstream forwarding and connectivity. The example log is deliberately fictional and does not reproduce an exact vendor log format. A single event is insufficient to identify root cause. Check time windows and compare evidence from a known internal record and an approved synthetic upstream.
Synthetic event summary (not actual CoreDNS log format)09:00:00 internal A inventory.books.svc.cluster.test. NOERROR09:00:01 upstream A upstream.example. SERVFAIL09:00:01 forwarder 192.0.2.53:53 no response09:00:02 internal A inventory.books.svc.cluster.test. NOERRORInspect before changing CoreDNS
Use only an authorized disposable lab. Read the actual DNS Service, its EndpointSlices, DNS Pods and relevant configuration; inspect logs without exporting private query names. ConfigMap access and log access require appropriate RBAC. Review DNS server readiness, resources, API permissions (including required watches) and upstream reachability. If query logging is necessary, minimize scope and retention; queries can reveal internal names and user activity. Do not grant broad cluster administrator access to repair a missing DNS permission.
kubectl --kubeconfig ./lab.kubeconfig --context dns-study -n kube-system get svc kube-dnskubectl --kubeconfig ./lab.kubeconfig --context dns-study -n kube-system get endpointslices -l kubernetes.io/service-name=kube-dnskubectl --kubeconfig ./lab.kubeconfig --context dns-study -n kube-system get deployment corednskubectl --kubeconfig ./lab.kubeconfig --context dns-study -n kube-system get configmap coredns -o yamlReview changes and verify recovery
Record the last known good configuration in an authorized lab, verify the plugin syntax against the deployed version, review changes and test in a disposable replica environment first. ConfigMap volume propagation and CoreDNS reload are asynchronous; the reload plugin can report errors and may keep the old configuration, with version-specific exceptions. Confirm the effective configuration, readiness, internal and approved upstream lookup results and request latency after the change. Scale only after diagnosing demand and resource limits; replicas do not repair an invalid configuration or broken upstream. If regression occurs, restore the reviewed known-good configuration through the approved mechanism and repeat the same checks. No change or restart is performed here.
Practice the change review
Open Corefile.example, corefile-configmap.yaml and operations-cases.json. Map each observation to a safe next step. Identify why the fictional upstream address cannot support a real external query, and write an approval, verification and rollback checklist. Explain why process health and a successful reload log are insufficient evidence of client-visible DNS recovery.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
CoreDNS operations — knowledge check
Interpret synthetic DNS and Service evidence.
Which CoreDNS plugin constructs records from Kubernetes objects?
Internal queries work, but the fictional upstream returns no response. What should be investigated first?
Why is a healthy CoreDNS process not enough to prove DNS recovery?
What is a safe response to an invalid Corefile change?
Why limit query logging?