Services configuration overview

This topic provides introduces the configuration items that enable you to register services with Consul so that they can connect to other services and nodes registered with Consul.

Service definitions

A service definition contains a set of parameters that specify various aspects of the service, including how it is discovered by other services in the network. The service definition may also contain health check configurations. Refer to Health Check Configuration Reference for configuration details about health checks.

Configure individual services and health checks by specifying parameters in the service block of a service definition file. Refer to Define Services for information about defining services.

To register a service, provide the service definition to the Consul agent. Refer to Register Services and Health Checks for information about registering services.

Consul supports service definitions written in JSON and HCL.

Service defaults

Use the service-defaults configuration entry to define the default parameters for service definitions. This enables you to configure common settings, such as namespace or partition for Consul Enterprise deployments, in a single definition.

You can use service-defaults configuration entries on virtual machines and in Kubernetes environments.

ACLs

Services registered in Consul clusters where both Consul Namespaces and the ACL system are enabled can be registered to specific namespaces that are associated with ACL tokens scoped to the namespace. Services registered with a service definition will not inherit the namespace associated with the ACL token specified in the token field. The namespace and the token parameters must be included in the service definition for the service to be registered to the namespace that the ACL token is scoped to.