Courseiva

CCNA Service Discovery Questions

40 questions · Service Discovery · All types, answers revealed

1
MCQhard

You are configuring a service check that needs to be ignored if the node is in maintenance mode. What is the correct approach?

A.Use a tag named 'maintenance'.
B.Set 'maintenance_mode' to true in the service definition.
C.Set the 'status' to 'maintenance' in the API.
D.Use the 'consul maintenance' command on the node.
AnswerD

The maintenance command puts the node into a state where health checks are ignored.

Why this answer

Maintenance mode stops health checks from affecting the service's passing/failing status.

2
MCQeasy

Which interface would you use to register a service dynamically using standard tools like 'curl'?

A.HTTP API
B.DNS interface
C.Gossip protocol
D.CLI agent command
AnswerA

The HTTP API allows POSTing service definitions.

Why this answer

The Consul HTTP API is the standard interface for dynamic registration.

3
MCQmedium

You need to register a health check that triggers an alert when memory usage is high. Which type of check is most appropriate?

A.gRPC Check
B.HTTP Check
C.Script Check
D.TCP Check
AnswerC

Script checks allow arbitrary local execution.

Why this answer

A script check can execute a local binary or script to monitor memory and return an exit code.

4
MCQhard

You need to register a service that runs on a dynamic port. How should the service definition be configured to allow Consul to detect the port?

A.Set 'port' to 'auto' in the service definition.
B.Omit the 'port' field entirely.
C.Use the 'address' field for the port.
D.Set 'port' to 0 in the service definition.
AnswerD

Setting port to 0 signals to Consul that the port is dynamic.

Why this answer

Consul allows the use of 0 as a port, and the registration process typically involves discovering the port via an external process or environment variable.

5
MCQmedium

You need to ensure a service instance is removed from the catalog immediately after the service process terminates. Which setting helps?

A.Use a 'pre-stop' script.
B.Set 'deregister_critical_service_after' to a short duration.
C.Enable 'auto_cleanup' in the agent config.
D.Set 'ttl' to 0.
AnswerB

This defines how long a service stays in the catalog after failing health checks.

Why this answer

The 'deregister_critical_service_after' setting defines the timeout before cleanup.

6
MCQmedium

A service definition includes a 'meta' block. What is the intended use of this block?

A.To configure service discovery timeouts.
B.To define arbitrary key/value metadata for the service.
C.To override the default health check interval.
D.To store authentication credentials.
AnswerB

Metadata allows for extensible annotations.

Why this answer

The meta block is for arbitrary key/value pairs related to the service instance.

7
Multi-Selecteasy

Which THREE of the following are valid check types in Consul?

Select 3 answers
A.TCP
B.HTTP
C.SSH
D.Script
E.FTP
AnswersA, B, D

Standard health check type.

Why this answer

Consul supports HTTP, TCP, and Script (external) health checks.

8
MCQmedium

How does Consul handle service discovery in multi-datacenter environments when a service is requested by name?

A.It only queries the leader of the entire WAN.
B.It automatically replicates all services to all datacenters.
C.It always returns instances from all datacenters.
D.It requires the user to append the datacenter name to the DNS query.
AnswerD

Using '<service>.service.<datacenter>.consul' enables cross-datacenter lookups.

Why this answer

Consul can perform cross-datacenter lookups if the query includes the datacenter or if configured to do so.

9
MCQmedium

You need to verify if a node has successfully joined the cluster for service discovery. Which tool confirms this?

A.consul members
B.consul catalog nodes
C.consul info
D.consul services
AnswerA

Members shows the gossip cluster status.

Why this answer

'consul members' lists the nodes in the cluster.

10
Multi-Selecthard

Which THREE of the following are valid ways to register a service in Consul?

Select 3 answers
A.Kubernetes Custom Resource Definitions.
B.Configuration files in the agent's config directory.
C.HTTP API 'v1/agent/service/register'.
D.Directly modifying the Consul database file.
E.Manual editing of the Raft log.
AnswersA, B, C

Used with Consul K8s.

Why this answer

Services can be registered via files, HTTP API, or Consul K8s mechanisms.

11
MCQmedium

Which Consul feature allows you to perform health checks against a service that does not have an exposed HTTP endpoint but resides on the same machine?

A.TCP health check.
B.Script health check.
C.HTTP health check.
D.gRPC health check.
AnswerB

Script checks can execute any command locally on the node.

Why this answer

Script-based checks run locally on the agent node, allowing monitoring of processes or system resources.

12
MCQhard

What is the impact of setting 'enable_tag_override' to true in a service definition?

A.It allows tags to be modified via the API without updating the config file.
B.It ignores all tags in the catalog.
C.It forces all nodes to update their tags.
D.It prevents tags from being used in DNS lookups.
AnswerA

Tag override permits dynamic tag updates.

Why this answer

It allows external systems to modify service tags without updating the service definition file.

13
MCQhard

When using Consul DNS for a service, what happens if no instances are healthy?

A.It returns a 500 error.
B.It redirects to a standby service.
C.It returns an empty response (NXDOMAIN or empty set).
D.It returns all instances regardless of health.
AnswerC

If no service instances are passing, the DNS resolver returns an empty set.

Why this answer

By default, if no healthy instances are found, the DNS query will return no results.

14
MCQmedium

You need to ensure that a service is only discoverable via DNS if it passes its health checks. Which configuration setting in the service definition achieves this?

A.Enable 'only_passing' in the DNS configuration.
B.Disable the agent's 'allow_stale' read setting.
C.Set the 'passing' parameter to true in the DNS query.
D.Set 'deregister_critical_service_after' to 0.
AnswerC

Using the passing query parameter filters results to only include services with passing health checks.

Why this answer

Consul allows filtering services based on health checks via the 'passing' parameter in the DNS interface or by defining the service with a health check.

15
Multi-Selectmedium

Which TWO of the following are true regarding the Consul Service Catalog?

Select 2 answers
A.It provides a unified view of all services in the cluster.
B.It is replicated across the cluster using Raft.
C.It is strictly read-only.
D.It is only accessible via the CLI.
E.It is stored in the local disk of every agent.
AnswersA, B

The catalog is the source of truth.

Why this answer

The catalog is replicated via Raft and can be queried via API or DNS.

16
MCQhard

When a service check transitions to 'critical', what does Consul do with the service's DNS entry?

A.It marks the record as 'stale'.
B.It removes the instance from the DNS response.
C.It returns the IP but with a low TTL.
D.It returns a 503 status code.
AnswerB

Consul dynamic DNS removes failed instances.

Why this answer

Consul removes the service instance from DNS results when its health check is critical.

17
Multi-Selecteasy

Which TWO of the following are standard DNS records returned by Consul for service discovery?

Select 2 answers
A.NS
B.SRV
C.A
D.SOA
E.PTR
AnswersB, C

Provides service port and target.

Why this answer

Consul uses SRV and A records for service resolution.

18
MCQmedium

When multiple agents are in a cluster, how does Consul ensure that service discovery information is consistent across all nodes?

A.Using a centralized database like PostgreSQL.
B.By polling the leader every second.
C.Via the Raft consensus protocol for catalog changes.
D.By broadcasting all service updates to every node.
AnswerC

Raft ensures a consistent replicated state machine for the catalog.

Why this answer

The Gossip Protocol (serf) and Raft consensus maintain state across nodes.

19
Multi-Selecthard

Which TWO of the following statements are true about the 'passing' parameter in DNS queries?

Select 2 answers
A.It requires manual service registration.
B.It returns only services with passing health checks.
C.It forces the DNS server to restart.
D.It is a permanent configuration setting.
E.It can be used in the DNS query URL.
AnswersB, E

Correct behavior.

Why this answer

It filters to only healthy instances and is specific to the DNS interface.

20
Multi-Selectmedium

Which THREE of the following fields are typically included in a service metadata (meta) block?

Select 3 answers
A.kernel_version
B.password
C.environment
D.region
E.version
AnswersC, D, E

Common use case.

Why this answer

Meta is used for arbitrary key-value pairs to support application logic.

21
MCQeasy

An administrator needs to query service information. Which DNS record type is commonly used by Consul to return service addresses?

A.TXT
B.MX
C.CNAME
D.SRV
AnswerD

SRV records are the standard for service discovery in DNS.

Why this answer

Consul maps service names to SRV or A records for discovery.

22
Multi-Selectmedium

Which TWO of the following can be used to filter services during a DNS query?

Select 2 answers
A.IP Address
B.Datacenter
C.Metadata
D.Tags
E.Node Name
AnswersB, D

Filters services by datacenter.

Why this answer

DNS queries allow filtering by tags and datacenters.

23
MCQeasy

What is the purpose of the 'service-tag' in a Consul service definition?

A.To provide additional categorization or versioning for services.
B.To define the physical location of the server.
C.To set the priority of the service in DNS.
D.To encrypt communication between services.
AnswerA

Tags are flexible labels for service instances.

Why this answer

Tags are used for filtering and identifying specific instances or versions of a service.

24
Multi-Selecteasy

Which TWO of the following describe a Consul 'service definition'?

Select 2 answers
A.A configuration that the agent watches for changes.
B.A database-specific configuration.
C.A static, immutable file.
D.A binary file loaded into the server.
E.A JSON or HCL file that describes a service.
AnswersA, E

The agent monitors the config dir.

Why this answer

They are JSON/HCL files and are monitored by the agent.

25
MCQhard

A service is intermittently failing to resolve via DNS because it has multiple health checks, some of which are 'warning'. How do you ensure it is only returned when all checks are 'passing'?

A.Configure 'service_prefix' in DNS settings.
B.Use the 'stale' query parameter.
C.Set 'enable_tag_override' to true.
D.Use the 'passing' query parameter in the DNS request.
AnswerD

The 'passing' parameter forces Consul to return only services with passing status.

Why this answer

Consul DNS returns services if they are not in a 'critical' state by default; enforcing strict 'passing' requires query parameters.

26
Multi-Selectmedium

Which THREE of the following are valid ways to categorize services in Consul?

Select 3 answers
A.IP subnets
B.Metadata (meta)
C.Namespaces
D.Tags
E.Port ranges
AnswersB, C, D

Used for custom attributes.

Why this answer

Tags, meta fields, and namespaces are ways to group services.

27
MCQeasy

What command displays the currently registered services in the local agent?

A.consul catalog services
B.consul show
C.consul agent services
D.consul services list
AnswerA

This lists all services known to the catalog.

Why this answer

'consul catalog services' is the standard way to list services.

28
MCQmedium

You have a service that requires specific routing logic based on the environment. How can you distinguish between 'production' and 'staging' instances of the same service name using metadata?

A.Use different service names for every environment.
B.Modify the service's port number.
C.Apply 'production' or 'staging' tags to the service definition.
D.Assign different Consul datacenters.
AnswerC

Tags allow for logical grouping and filtering of services sharing the same name.

Why this answer

Service tags are the standard way to categorize and filter services within the Consul catalog.

29
MCQhard

How does Consul handle service discovery when using the 'prepared query' feature?

A.By pre-compiling the service discovery logic.
B.By automatically creating new services.
C.By disabling health checks.
D.By caching all DNS records in memory.
AnswerA

Prepared queries act as a template for discovery with advanced features.

Why this answer

Prepared queries allow for complex, pre-defined discovery logic including failover.

30
Multi-Selecthard

Which TWO of the following actions occur when a node fails in a Consul cluster?

Select 2 answers
A.All services on the node are marked critical.
B.The node is immediately deleted from the cluster.
C.The node is automatically rebooted.
D.Services on the node are removed from DNS results.
E.The entire cluster shuts down.
AnswersA, D

Health status changes.

Why this answer

The node is marked down, and its services are removed from the catalog.

31
MCQeasy

Which of the following best describes the 'consul agent -dev' mode in relation to service discovery?

A.It disables DNS interfaces.
B.It forces the service catalog to be stored in Redis.
C.It is suitable for production clusters.
D.It provides a single-node Consul environment for testing.
AnswerD

Dev mode creates a quick, single-node cluster.

Why this answer

Dev mode is for testing and has ephemeral storage.

32
MCQeasy

Which file format is primarily used for defining services in Consul?

A.YAML
B.TOML
C.JSON
D.XML
AnswerC

JSON is the standard format for Consul configuration.

Why this answer

Consul supports JSON or HCL.

33
MCQeasy

Which command is used to check the status of a registered service?

A.consul check
B.consul health service
C.consul status
D.consul list
AnswerB

The 'consul health service' command shows the status of specific instances.

Why this answer

'consul catalog' or 'consul health' commands are used for status inspection.

34
Multi-Selecthard

Which THREE of the following are key components of a service definition?

Select 3 answers
A.Secret Key
B.Node BIOS version
C.Check/Health Check
D.Port
E.Service Name
AnswersC, D, E

Critical for service discovery.

Why this answer

Service definitions include the name, port, and health check requirements.

35
MCQmedium

You are querying the Consul DNS interface for a service. How can you exclude specific tags from the results?

A.Use the '!' character before the tag name.
B.Consul DNS does not support tag exclusion; you must filter via the HTTP API.
C.Add a 'not' parameter to the query.
D.Use regex in the service name.
AnswerB

DNS queries are limited; complex filtering requires the HTTP API.

Why this answer

Consul DNS queries do not support tag exclusion directly in the query string; you filter by including only the desired tags.

36
MCQmedium

You are troubleshooting why a service registered via HTTP API is not showing up in the catalog. Which tool provides the most immediate insight into the registration status?

A.consul kv get
B.consul catalog services
C.consul reload
D.consul members
AnswerB

This command lists all services currently registered in the catalog.

Why this answer

The 'consul catalog' CLI command allows direct inspection of the catalog state.

37
MCQmedium

What is the effect of changing the 'interval' parameter in a service health check?

A.It changes the frequency at which the check runs.
B.It changes the DNS TTL.
C.It changes the weight of the service.
D.It changes the timeout of the check.
AnswerA

Interval determines the check frequency.

Why this answer

The interval defines how often the health check executes.

38
Multi-Selectmedium

Which THREE of the following are benefits of using the Consul DNS interface?

Select 3 answers
A.No application code changes required.
B.Provides advanced traffic shifting.
C.Platform-agnostic discovery.
D.Encrypts all traffic between services.
E.Easy integration with existing service discovery tools.
AnswersA, C, E

DNS is a standard protocol.

Why this answer

Ease of use, platform-agnostic, and no application changes are benefits.

39
MCQeasy

An administrator wants to register a service using a JSON file. Where should this file be placed on a standard Consul agent installation to ensure automatic loading?

A./var/lib/consul/
B./etc/consul/
C./etc/consul.d/
D./usr/local/bin/
AnswerC

The default configuration directory for Consul is typically /etc/consul.d/.

Why this answer

The Consul agent watches the directory defined by the '-config-dir' flag.

40
Multi-Selecthard

Which THREE of the following are valid Consul health check statuses?

Select 3 answers
A.maintenance
B.warning
C.passing
D.unknown
E.critical
AnswersB, C, E

Degraded state.

Why this answer

Passing, Warning, and Critical are the three standard states.

Ready to test yourself?

Try a timed practice session using only Service Discovery questions.