50 Consul Service Discovery Interview Questions (2027)

50 Consul service discovery interview questions: catalog, DNS on port 8600, health checks, prepared queries, KV, blocking queries, ACLs and scenarios.

Sep 26, 2025 - 14:35
Nov 15, 2026 - 08:45
 0  41
TOPICInterview Q & APractical guide
50 Consul Service Discovery Interview Questions (2027)

Consul service discovery interviews test whether you can explain how services get registered with a local agent, how the catalog and health checks decide which instances are returned, and how clients find them through DNS on port 8600 or the HTTP API on port 8500. This page has 50 questions with direct answers, from basics to scenarios.

Every port, default and command below was checked against HashiCorp's Consul documentation in November 2026. This guide stays on discovery: catalog, DNS, health checks, KV, prepared queries and ACL basics. For the mesh side, see our Consul service mesh interview questions, and for a wider list of DevOps topics, the 200+ DevOps interview questions hub.

Key takeaways

  • Services register with their local Consul agent. The agent's view is authoritative, and anti-entropy syncs it to the catalog held on the servers.
  • Default ports: 8600 for DNS (TCP and UDP), 8500 for HTTP, 8300 for server RPC, 8301 for LAN gossip and 8302 for WAN gossip. HTTPS and gRPC have no default outside dev mode; 8501 and 8502 are the conventions.
  • DNS service lookups use the form <service>.service.consul. By default, DNS excludes only instances with critical checks; set only_passing to exclude warning as well.
  • Health checks start in the critical state. The types are script, HTTP, TCP, UDP, TTL, Docker, gRPC, H2ping, alias and OSService.
  • Prepared queries add failover to other datacenters, tag filters and templates on top of plain DNS.
  • KV values are limited to 512 KB. Use KV for configuration and coordination, not as an application database.
  • HashiCorp has retired the Consul Associate exam; 15 July 2026 was the last day to sit it. Prepare for Consul as an interview topic, not an exam.

Is there still a Consul certification?

No. HashiCorp retired the Consul Associate certification, and the last day to take the exam was 15 July 2026. If a job description still asks for it, a candidate who passed before that date can mention it, but new candidates should show skill through projects and interview answers. Our post on the Consul certification retirement covers what changed and how to prepare instead.

How to use this guide

Your levelFocus onHands-on task
FresherQuestions 1 to 18Run consul agent -dev, register a service and resolve it with dig
2 to 5 yearsQuestions 19 to 36Add HTTP and TTL checks, write a prepared query, use blocking queries
SeniorQuestions 37 to 42 and scenarios 43 to 50Enable ACLs with default_policy deny and fix the discovery that breaks

If you want a shorter fresher list first, read the most asked Consul interview questions. For architecture, Raft and multi-datacenter design, use the Consul engineer interview questions.

Fresher level: core service discovery

1. What problem does service discovery solve?

It lets a client find the current network location of a service without hardcoded IP addresses. In dynamic environments instances come and go with autoscaling, deploys and failures. A registry like Consul keeps an up-to-date list of healthy instances so clients always connect to something that works.

2. How does Consul do service discovery at a high level?

Each node runs a Consul agent. Services register with that local agent, along with health checks. The agent runs the checks and reports to the servers, which keep the catalog. Clients then query Consul through DNS or the HTTP API and get back the addresses of instances that are not failing.

3. What is the difference between a Consul client agent and a server agent?

Server agents store the cluster state, including the catalog and KV data, and take part in consensus. Client agents are lightweight: they register local services, run health checks and forward requests to servers. A typical datacenter has a small odd number of servers and many clients.

4. What is the Consul catalog?

The catalog is the cluster-wide record of nodes, the services on them and their health checks. It lives on the servers. Agents push their local services and checks to it, and the catalog endpoints return the raw entries without filtering by health.

5. Which default ports should you know?

DNS is 8600 over TCP and UDP. The HTTP API is 8500. Server RPC is 8300. Serf LAN gossip is 8301 and Serf WAN gossip is 8302. HTTPS is disabled by default and 8501 is the convention. gRPC has no default outside -dev mode, where it uses 8502.

6. How do you register a service?

The most common way is a service definition file loaded by the local agent, usually at startup. (consul reload triggers a reload of the agent's configuration files, though not every option is reloadable.) You can also call the agent HTTP API or run consul services register. A minimal definition looks like this:

service {
  name = "web"
  port = 8080
  tags = ["v1"]
  check {
    http     = "http://localhost:8080/health"
    interval = "10s"
    timeout  = "2s"
  }
}

7. What is the DNS name for a service?

The basic form is <service>.service.consul, for example web.service.consul. You can prefix a tag, such as v1.web.service.consul, and add a datacenter segment to query another datacenter. The default domain is consul unless the agent is configured otherwise.

8. How do you test DNS discovery locally?

Query the agent directly on port 8600 with dig. For SRV records, which include ports, ask for type SRV:

dig @127.0.0.1 -p 8600 web.service.consul
dig @127.0.0.1 -p 8600 web.service.consul SRV

9. What is the SRV lookup format?

Consul accepts _<service>._<protocol>.service.consul, for example _web._tcp.service.consul. SRV answers carry the port as well as the target, which matters when instances run on dynamic ports.

10. How do you look up a node instead of a service?

Use <node>.node.consul. It returns the address of that node. It is useful for infrastructure tooling but less common for application traffic, which should target services.

11. What health check types does Consul support?

Script, HTTP, TCP, UDP, TTL, Docker, gRPC, H2ping, alias and OSService. HTTP and TCP checks are the most common for web services. TTL checks are pushed by the application itself, and alias checks mirror the health of another node or service.

12. What are the health check states?

Passing, warning and critical. For script checks, exit code 0 is passing, 1 is warning and anything else is critical. For HTTP checks, a 2xx response is passing, 429 is warning and anything else is critical.

13. What state does a new check start in?

Critical. Consul assigns checks a critical status when they are registered, so a new instance does not receive traffic until its first check passes. You can set an initial status in the definition if you need different behavior.

14. Does Consul DNS return unhealthy instances?

It excludes instances whose checks are critical. With the default only_passing = false, instances in the warning state are still returned. Setting dns_config.only_passing to true excludes warning instances too.

15. What does the HTTP API add over DNS?

The HTTP API returns richer data: tags, metadata, check output and node details. The health endpoint /v1/health/service/<name> accepts passing to return only fully healthy instances, filter expressions, near for sorting by round-trip time, and dc to query another datacenter.

16. What is the difference between /v1/catalog/service and /v1/health/service?

The catalog endpoint returns the raw registered entries. The health endpoint adds health information and can filter to passing instances. For discovery decisions, use the health endpoint.

17. What is the Consul KV store used for in discovery setups?

It holds configuration that services need, such as feature flags, connection settings or maintenance switches. The data lives on the servers and replicates across them. Each value can be up to 512 KB.

18. Which CLI commands inspect what is registered?

consul catalog services lists services, consul catalog nodes lists nodes, and consul catalog nodes -service=web shows which nodes run a given service. consul members shows the gossip membership.

Intermediate level: health, queries and data

19. What is anti-entropy in Consul?

It is the process that keeps the catalog in line with each agent's local state. Consul treats the agent as authoritative. If the catalog and the agent disagree, the agent's view wins and is synced. Runs happen every minute in clusters of up to 128 nodes and less often in larger ones, with staggered start times.

20. Why should services register with the local agent rather than directly with the catalog?

Because the local agent runs the health checks and anti-entropy keeps its registrations alive. Entries written straight to the catalog with the catalog register endpoint have no agent behind them, so nothing checks their health or cleans them up. That approach is meant for external services.

21. How does a TTL check work?

The application must report its status to the agent before the TTL expires, using the agent check pass, warn or fail endpoints. If it does not, the check turns critical. TTL checks suit workers and batch processes where an HTTP endpoint does not exist.

22. Why are script checks risky and how do you enable them safely?

Script checks run commands on the host. They are off by default. enable_local_script_checks allows only checks defined in local configuration files, while enable_script_checks allows them from any source, including the API. HashiCorp recommends the local-only option because remote registration of scripts can create a remote execution risk.

23. What are the default check timeouts?

Script checks time out after 30 seconds by default. HTTP, TCP, UDP, gRPC and H2ping checks time out after 10 seconds. Set an explicit timeout shorter than the interval so a slow check does not overlap the next run.

24. What is an alias check?

An alias check takes its status from another node or service. A common use is making a sidecar or dependent service report critical when the service it fronts is critical, so traffic does not reach a component whose backend is down.

25. What is a prepared query?

A query stored in Consul through /v1/query that you can run by ID or name, over HTTP or DNS. It can filter by tags, choose only passing instances, sort by distance and fail over to other datacenters when no healthy local instances exist.

26. How do you call a prepared query through DNS?

Use <query>.query.consul, or _<query>._<protocol>.query.consul for SRV. Applications keep using plain DNS while the query adds logic behind the name.

27. How does prepared query failover work?

NearestN forwards the query to up to N other datacenters ordered by estimated round-trip time. Datacenters is a fixed ordered list. If both are set, NearestN runs first. Targets fails over to cluster peers and cannot be combined with the other two.

{
  "Name": "payments",
  "Service": {
    "Service": "payments",
    "OnlyPassing": true,
    "Near": "_agent",
    "Failover": { "NearestN": 2 }
  },
  "DNS": { "TTL": "10s" }
}

28. What does OnlyPassing do in a prepared query?

With the default of false, results include instances in passing and warning states. With true, only passing instances are returned. It is the prepared query equivalent of the DNS only_passing setting.

29. What are prepared query templates?

A template uses "Type": "name_prefix_match" and applies to any query name that starts with its prefix. Variables such as ${name.suffix} fill in the service name, so one template can give every service the same failover policy. The longest prefix wins, and static queries take priority over templates.

30. What do DNS TTLs default to and why change them?

Node and service lookups are served with a TTL of 0 by default, so clients do not cache them. Setting node_ttl or service_ttl lets clients and resolvers cache answers, which cuts load on agents at the cost of slower reaction to changes.

31. What are allow_stale and max_stale?

allow_stale lets any server answer DNS queries instead of only the leader, which spreads load. It defaults to true since Consul 0.7. max_stale limits how old that data can be and defaults to 87600h, effectively no limit.

32. How do you forward *.consul queries from the system resolver?

Configure the host's DNS resolver to send the consul domain to the agent on port 8600, for example with systemd-resolved, dnsmasq or BIND conditional forwarding. Consul's recursors setting covers the other direction, letting Consul forward names it does not own to upstream resolvers.

33. What is a blocking query?

A long poll. The client sends the last X-Consul-Index value it saw as the index parameter, and the server holds the request until something changes or the wait time runs out. The default wait is 5 minutes and the maximum is 10 minutes, with up to wait/16 of jitter added.

34. How do watches and Consul Template use discovery data?

Watches monitor a view such as a key or service list and run a handler when it changes. Consul Template renders files from Go templates using service and KV data, then can run a command like reloading a load balancer. Both rely on blocking queries.

35. How do you work with KV from the CLI?

consul kv put config/web/max_conns 200
consul kv get config/web/max_conns
consul kv get -recurse config/web/
consul kv delete config/web/max_conns

36. How do sessions build a lock on KV?

A session ties together a node, its health checks and KV operations. A client acquires a key with its session, and the acquire acts like a check-and-set: only one session can hold it. If the session is invalidated, for example because a linked check fails, the lock is released. This is how leader election is built on Consul.

Senior level: ACLs, scale and design

37. What are the main ACL objects?

Tokens authenticate requests through their SecretID. Policies are sets of rules granting or denying access. Roles group policies so you can change permissions without reissuing tokens. Service identities and node identities generate standard policies for a service or node, which saves writing one by hand.

38. What do default_policy and down_policy control?

default_policy decides what happens when no rule matches. It defaults to allow, and HashiCorp notes that this will change in a future major release; production clusters set it to deny. down_policy decides what happens when tokens cannot be resolved from the primary datacenter or leader, with options allow, deny, extend-cache and async-cache, and extend-cache as the default.

39. What breaks for discovery when you set default_policy to deny?

Anonymous DNS and API queries can no longer read services or nodes, so lookups return nothing. The usual fix is to give the anonymous token, or a default token set in acl.tokens.default, a policy with read access to services and nodes, and to give each agent a token through acl.tokens.agent so it can register itself.

40. Why use service identities?

A service identity creates the policy a service needs to register itself and discover others, without custom rules. It keeps per-service tokens consistent across hundreds of services and reduces mistakes in hand-written policies.

41. How does discovery work across datacenters?

Servers in different datacenters connect over WAN gossip on 8302. A client can query another datacenter by adding its name to the DNS query or with the dc parameter on the API. Prepared queries automate this as failover, so a service in one datacenter can fall back to another only when the local one has no healthy instances.

42. How do you keep discovery load from overwhelming servers in a large cluster?

Let client agents answer DNS from their local view where possible, keep allow_stale on so followers serve reads, set modest DNS TTLs, use blocking queries instead of tight polling, and use streaming for health queries where supported. Watch server CPU and RPC rates as the number of watchers grows.

Scenario questions

43. A new instance is registered but never receives traffic. What do you check?

First, its health. New checks start critical, so check output in /v1/health/service/<name> or the UI. Common causes are a health URL that returns a non-2xx code, a timeout shorter than the endpoint's response time, or a check bound to the wrong port. Also confirm the service registered on the right agent and in the right datacenter.

44. dig against port 8600 works on the host but the application cannot resolve web.service.consul. Why?

The application uses the system resolver, which does not know about the consul domain. Configure conditional forwarding for consul to the local agent on port 8600, or point containers at a resolver that forwards it. Check that firewalls allow UDP and TCP to 8600, since large answers fall back to TCP.

45. Clients keep hitting an instance that returns warnings. How do you stop it?

DNS returns warning instances by default. Set dns_config.only_passing = true, use passing on API calls, or use a prepared query with OnlyPassing true. Then confirm the check's warning condition is meaningful and not just noise.

46. After a node crash, dead instances stay in the catalog for a long time. What fixes it?

When an agent disappears, its node is marked failed and its services fail health checks, so they drop out of healthy results. To remove them entirely, set deregister_critical_service_after on the check so services critical longer than that window are deregistered, and use consul force-leave for nodes that will not return.

47. A region loses all instances of payments. How should clients keep working?

Create a prepared query for payments with OnlyPassing and a failover setting such as NearestN or a fixed Datacenters list, then have clients resolve payments.query.consul. Local healthy instances are preferred, and remote ones are used only when needed. Test the failover path before you need it.

48. After turning on ACLs, DNS lookups return empty answers. What happened?

With default_policy deny, the token used for DNS has no read access. Grant service and node read through the anonymous token or a configured default token, and make sure agents have tokens to register their own services. Check agent logs for permission denied messages.

49. Consul servers show high CPU from health queries every second. What do you change?

Replace tight polling with blocking queries or Consul Template so clients only wake on changes. Add DNS TTLs so resolvers cache answers briefly, confirm allow_stale is on, and look for one misbehaving client generating most of the load.

50. A team wants to store per-request session data in Consul KV. How do you respond?

Advise against it. KV values are capped at 512 KB, the data is replicated to every server through consensus, and heavy write traffic slows the whole cluster. KV fits configuration, flags and coordination such as locks. Session data belongs in a cache or database built for that load.

How to prepare in two weeks

In the first week, run a dev agent, register two or three services with HTTP checks, resolve them with dig, query the health API, and break a check on purpose to see the instance disappear from DNS. Store a few keys in KV and watch them change with a blocking query.

In the second week, build a small three-server cluster with containers or VMs, turn on ACLs with default_policy deny, and repair discovery with tokens. Write a prepared query with failover between two datacenters. Then rehearse the scenario answers aloud. For more practice, read the scenario-based Consul questions on operations and the Consul FAQs asked in DevOps interviews.

Consul usually sits next to Terraform, Kubernetes and CI/CD in DevOps roles. Our DevOps training covers that wider toolchain in the Kharadi, Pune classroom and live online across India.

Frequently asked questions

Which port does Consul DNS use?

Port 8600 over both UDP and TCP by default. The HTTP API uses 8500.

Does Consul DNS return instances with warning checks?

Yes, by default. DNS excludes only critical instances unless you set only_passing to true in the DNS configuration.

Is the Consul Associate certification still available?

No. HashiCorp retired it, and 15 July 2026 was the last day to sit the exam. Prepare for Consul through hands-on practice and interview questions instead.

What is the size limit for a Consul KV value?

512 KB per value. KV is meant for configuration and coordination, not bulk data.

What state does a new Consul health check start in?

Critical. The instance is not returned as healthy until its first check passes.

What is a Consul prepared query?

A stored query run by name or ID over HTTP or DNS that can filter by tags, return only passing instances, sort by distance and fail over to other datacenters.

What is the default ACL policy in Consul?

default_policy defaults to allow, and HashiCorp says this will change in a future major release. Production clusters normally set it to deny.

References

Interested in learning more?Get a callback from our training advisors.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.