Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 134/ 160
07. Observability, Troubleshooting & SRE

DNS & CoreDNS Latency/Failure Diagnostics

Diagnose CoreDNS latency, NXDOMAIN storms, and ndots pitfalls.

IntermediateCoreDNS · Latency · ndots3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

DNS tuning is separating directory lookup, cache, and upstream roads before adding more clerks to a line caused by a missing bridge. The simple Kubernetes rule is: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

Think of it like…

DNS tuning is separating directory lookup, cache, and upstream roads before adding more clerks to a line caused by a missing bridge.

Where you’ve seen it

An SRE testing a diagnosis runs kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local. Expected evidence: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache. If the run instead shows this symptom, stop and restore the last known state: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses.

Words you’ll hear

CoreDNS
For this lesson, CoreDNS is the controlling idea: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.
Latency
Latency is the checkpoint; run kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local and inspect the owner chain. An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses.
ndots
ndots is the outcome to preserve; the cost is explicit: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure.
Verification evidence
The evidence command is kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local. It connects the declaration to this behavior: Diagnose CoreDNS latency, NXDOMAIN storms, and ndots pitfalls.

Visual diagram

Loading interactive diagram

Theory & deep dive

How CoreDNS reaches the intended state

Diagnose CoreDNS latency, NXDOMAIN storms, and ndots pitfalls. CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

The concrete checkpoint is kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local; compare the CoreDNS owner, Latency state, and ndots outcome instead of treating YAML acceptance as proof.

Verify Latency, not only object creation

Run kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local after the change and correlate the result with Events and the owning object. CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

Key takeaway: CoreDNS is implemented only when this invariant remains observable: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

Latency: failure boundary and production cost

An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses. The prerequisite contract is concrete: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure. A safe design limits blast radius, records the last good configuration, and uses kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local as a deterministic rollback checkpoint.

Recover from Latency drift

Capture the current state with kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses.

Key takeaway: Accept the trade-off consciously: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure.

How it works, step by step

Step 1 of 4
SRE and service owner

1. Define the symptom and SLI

Turn the user symptom into a measurable question and select a telemetry source: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

CoreDNS contract → owned state
Key numbers at this step
Goal
Diagnose CoreDNS latency, NXDOMAIN storms, and ndots pitfalls.
Owner
CoreDNS

When to use it & trade-offs

What it is

Diagnose CoreDNS latency, NXDOMAIN storms, and ndots pitfalls. CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

Why it matters: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses. The invariant at risk is specific: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache. The quickest fact check before changing the design is kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local.

When to reach for it

  • Use CoreDNS to enforce this invariant: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.
  • Use Latency evidence from kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local in reviews and incident timelines. Diagnose CoreDNS latency, NXDOMAIN storms, and ndots pitfalls.
  • Choose the managed observability backend route only when this cost is justified by governance or scale: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure.

When to avoid or be careful

  • Avoid assuming CoreDNS is complete after YAML submission; the required behavior is concrete: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local first: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure.

Native, manual, and managed paths for CoreDNS

Metrics and evidence-led diagnosis
Best for: Diagnose CoreDNS latency, NXDOMAIN storms, and ndots pitfalls. A concrete incident check is kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local.

Strengths: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

Watch out: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure. Recovery must also recognize this signal: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses.

Ad-hoc console inspection
Best for: Quickly testing the Latency assumption with kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local; the expected invariant is: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

Strengths: kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike CoreDNS, it does not make this symptom self-documenting: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses.

Managed observability backend
Best for: Teams that need ndots integrated with guardrails; the evidence path is kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.

Watch out: The added platform ownership buys value at this cost: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.
  • Trace CoreDNS to ndots through Latency; the invariant is: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.
  • Recognize the symptom: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses.
  • Justify the cost: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure.
  • Verify with kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local instead of only inspecting YAML.

Benchmarks & rules of thumb

5 -
default ndots value in many resolvers
53 -
DNS port
2 -
transports should be tested: UDP and TCP

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the CoreDNS owner contract: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache.
  • Ignoring this telltale condition leads to unrelated changes: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses.
  • Repeating kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local without an owner for remediation wastes retry cost. Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache?
  • Which owner object, logs, and Events would you inspect for this symptom-An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses-?
  • At what threshold would this cost become unacceptable: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure?
Interview tip: Interview sequence: state the invariant, run kubectl get pods -n kube-system -l k8s-app=kube-dns; kubectl logs -n kube-system -l k8s-app=kube-dns; kubectl exec dns-test -- dig api.prod.svc.cluster.local, name the failure, then justify the cost. Invariant: CoreDNS diagnosis measures NXDOMAIN, SERVFAIL, REFUSED, lookup latency, cache hits, upstream timeouts, and Pod resolver ndots behavior before tuning replicas or cache. Failure: An external FQDN without a trailing dot can traverse all search suffixes under ndots, and UDP-only firewall tests miss TCP fallback or large responses. Cost: Autoscaling CoreDNS can hide a bad upstream, while more cache improves common names but lengthens stale-record exposure.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply DNS & CoreDNS Latency/Failure Diagnostics with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Control Plane & etcd Performance Troubleshooting
Next topic
Resource Optimization & Right-Sizing (Goldilocks, Kubecost, OpenCost)