← Consul: discovery, mesh, and operations
03 / 7 · 40 MIN

Registration, health checks, and DNS

Interpret state from registration through to the endpoint consumer.

Concept and mechanism

A service name represents a function with potentially many instances; the ID distinguishes registrations within a node. Two instances on one node need separate IDs even when sharing a name. On VMs, definitions can load with the agent, reload, or register through CLI and API. Choose a method with clear persistence and configuration management. A TCP check tests connection acceptance rather than correct business-operation execution. A well-designed HTTP check can observe readiness but should avoid unintended real effects and dependencies causing cascading failures. Published status is evidence from the configured check rather than a universal guarantee.

Guided application

Discovery adds filtering and consumer behavior. With only_passing false, warning can remain in DNS answers; critical is excluded in the described configuration. Prepared queries support additional criteria and remote lookup under supported topology. In a fictional incident, a direct query already shows recovered endpoints while the resolver retains a negative response. Investigate positive and negative caching, TTL, resolver configuration, and connection reuse. Increasing TTL reduces queries but can extend staleness. Consul-side stale reads are another dimension: they permit results from servers without a leader without proving those results reflect the latest change. The runbook should identify which layer returned each answer.

IN PRACTICE

TCP passes and HTTP returns 500: the check can be correct for its measurement and insufficient for the service.

Common pitfalls

Name as globally unique ID; warning always excluded; zero TTL as proof the application is current.

Related topics: Discovery, architecture, and quorum · Deployment and bootstrap · Mesh, identity, and intentions

Take this idea with you

Validate the check contract and follow the response to the actual consumer.

Create account

Reference: Register services and checks · Historical Consul Associate (003), retired 2026-07-15; technical references inspected 2026-09-30