When using multiple datacenters, what is the primary role of the 'consul-template' tool?
Consul-template watches the Consul catalog and KV store, then renders templates into local configuration files and reloads dependent services. Across datacenters it queries the relevant Consul servers, so the stem's requirement for generating configuration from Consul data is met directly.
Why this answer
consul-template is a daemon that watches Consul for changes (KV pairs, services, health checks) and renders configuration files from templates, optionally running commands when files change. Its primary role is dynamic configuration generation based on Consul data, commonly used to configure HAProxy, Nginx, or Vault. It does not provision infrastructure or manage the cluster.
Exam trap
Consul 1.15 often tests the confusion between consul-template (config rendering) and Consul's built-in features like KV replication or cluster management — candidates assume consul-template does more than render files.
How to eliminate wrong answers
Option B is wrong because infrastructure provisioning is the job of tools like Terraform or CloudFormation — consul-template only renders config files and can run a reload command. Option C is wrong because KV replication across datacenters is handled by Consul's native replication (via the WAN gossip and Raft replication of the KV store), not by consul-template. Option D is wrong because cluster node management is done via Consul's own CLI/API and server agents — consul-template is a client-side rendering tool.