2019-07-09 02:11:19 +00:00
---
2020-04-07 18:55:19 +00:00
layout: docs
2020-04-06 20:27:35 +00:00
page_title: 'Configuration Entry Kind: Service Defaults'
2020-04-07 18:55:19 +00:00
description: >-
The service-defaults config entry kind controls default global values for a
service, such as its protocol.
2019-07-09 02:11:19 +00:00
---
# Service Defaults
2020-12-16 16:57:43 +00:00
-> **v1.8.4+:** On Kubernetes, the `ServiceDefaults` custom resource is supported in Consul versions 1.8.4+.<br />
**v1.5.0+:** On other platforms, this config entry is supported in Consul versions 1.5.0+.
The `service-defaults` config entry kind (`ServiceDefaults` on Kubernetes) controls default global values for a
2019-07-09 02:11:19 +00:00
service, such as its protocol.
## Sample Config Entries
2020-12-16 16:57:43 +00:00
### Default protocol
2021-08-02 20:23:58 +00:00
-> **NOTE**: The default protocol can also be configured globally for all proxies
using the [proxy defaults](/docs/connect/config-entries/proxy-defaults#default-protocol)
config entry. However, if the protocol value is specified in a service defaults
config entry for a given service, that value will take precedence over the
globally configured value from proxy defaults.
2020-03-09 20:51:21 +00:00
Set the default protocol for a service in the default namespace to HTTP:
2019-07-09 02:11:19 +00:00
2021-06-13 00:53:50 +00:00
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
2019-07-09 02:11:19 +00:00
```hcl
2020-06-16 18:28:21 +00:00
Kind = "service-defaults"
Name = "web"
2020-03-09 20:51:21 +00:00
Namespace = "default"
2020-06-16 18:28:21 +00:00
Protocol = "http"
2019-07-09 02:11:19 +00:00
```
2020-12-16 16:57:43 +00:00
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceDefaults
metadata:
name: web
spec:
protocol: http
```
2021-06-13 00:53:50 +00:00
```json
{
"Kind": "service-defaults",
"Name": "web",
"Namespace": "default",
"Protocol": "http"
}
```
</CodeTabs>
2020-12-16 16:57:43 +00:00
2021-06-22 22:04:50 +00:00
### Upstream configuration
2021-04-16 19:50:02 +00:00
2021-06-22 23:56:53 +00:00
<Tabs>
<Tab heading="Consul OSS">
2021-04-16 19:50:02 +00:00
Set default connection limits and mesh gateway mode across all upstreams
2021-06-13 00:53:50 +00:00
of "counting", and also override the mesh gateway mode used when dialing
2021-06-22 23:56:53 +00:00
the "dashboard" service.
2021-04-16 19:50:02 +00:00
2021-06-13 00:53:50 +00:00
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
2021-04-16 19:50:02 +00:00
```hcl
Kind = "service-defaults"
Name = "counting"
UpstreamConfig = {
Defaults = {
MeshGateway = {
Mode = "local"
}
Limits = {
MaxConnections = 512
MaxPendingRequests = 512
MaxConcurrentRequests = 512
}
}
Overrides = [
{
Name = "dashboard"
MeshGateway = {
Mode = "remote"
}
}
]
}
```
2021-06-13 00:53:50 +00:00
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceDefaults
metadata:
name: counting
spec:
upstreamConfig:
defaults:
meshGateway:
mode: local
limits:
maxConnections: 512
maxPendingRequests: 512
maxConcurrentRequests: 512
overrides:
- name: dashboard
meshGateway:
mode: remote
```
```json
{
"Kind": "service-defaults",
"Name": "counting",
"UpstreamConfig": {
"Defaults": {
"MeshGateway": {
"Mode": "local"
},
"Limits": {
"MaxConnections": 512,
"MaxPendingRequests": 512,
"MaxConcurrentRequests": 512
}
},
"Overrides": [
{
"Name": "dashboard",
"MeshGateway": {
"Mode": "remote"
}
}
]
}
}
```
</CodeTabs>
2021-04-16 19:50:02 +00:00
</Tab>
2021-06-22 23:56:53 +00:00
<Tab heading="Consul Enterprise">
2021-04-16 19:50:02 +00:00
Set default connection limits and mesh gateway mode across all upstreams
of "counting" and also override the mesh gateway mode used when dialing
the "dashboard" service in the "frontend" namespace.
2021-06-13 00:53:50 +00:00
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
2021-04-16 19:50:02 +00:00
```hcl
Kind = "service-defaults"
Name = "counting"
Namespace = "product"
UpstreamConfig = {
Defaults = {
MeshGateway = {
Mode = "local"
}
Limits = {
MaxConnections = 512
MaxPendingRequests = 512
MaxConcurrentRequests = 512
}
}
Overrides = [
{
Name = "dashboard"
Namespace = "frontend"
MeshGateway = {
Mode = "remote"
}
}
]
}
```
2021-06-22 23:56:53 +00:00
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceDefaults
metadata:
name: counting
namespace: product
spec:
upstreamConfig:
defaults:
meshGateway:
mode: local
limits:
maxConnections: 512
maxPendingRequests: 512
maxConcurrentRequests: 512
overrides:
- name: dashboard
namespace: frontend
meshGateway:
mode: remote
```
2021-06-13 00:53:50 +00:00
```json
{
"Kind": "service-defaults",
"Name": "counting",
"Namespace": "product",
"UpstreamConfig": {
"Defaults": {
"MeshGateway": {
"Mode": "local"
},
"Limits": {
"MaxConnections": 512,
"MaxPendingRequests": 512,
"MaxConcurrentRequests": 512
}
},
"Overrides": [
{
"Name": "dashboard",
"Namespace": "frontend",
"MeshGateway": {
"Mode": "remote"
}
}
]
}
}
```
2021-11-02 21:21:15 +00:00
2021-06-13 00:53:50 +00:00
</CodeTabs>
2021-04-16 19:50:02 +00:00
</Tab>
</Tabs>
2022-08-08 20:28:37 +00:00
### Terminating gateway destination
Create a default destination that will be assigned to a terminating gateway. A destination
represents a location outside the Consul cluster. They can be dialed directly when transparent proxy mode is enabled.
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
```hcl
Kind = "service-defaults"
Name = "test-destination"
Protocol = "tcp"
Destination {
Addresses = ["test.com","test.org"]
Port = 443
}
```
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceDefaults
metadata:
name: test-destination
spec:
destination:
addresses:
- "test.com"
- "test.org"
port: 443
```
```json
{
"Kind": "service-defaults",
"Name": "test-destination",
"Protocol": "http",
"Destination": {
"Addresses": ["test.com","test.org"],
"Port": 443
}
}
```
</CodeTabs>
2019-07-09 02:11:19 +00:00
## Available Fields
2020-12-16 16:57:43 +00:00
<ConfigEntryReference
keys={[
{
name: 'apiVersion',
description: 'Must be set to `consul.hashicorp.com/v1alpha1`',
hcl: false,
},
{
name: 'Kind',
description: {
hcl: 'Must be set to `service-defaults`',
yaml: 'Must be set to `ServiceDefaults`',
},
},
{
name: 'Name',
description: 'Set to the name of the service being configured.',
type: 'string: <required>',
yaml: false,
},
{
name: 'Namespace',
type: `string: "default"`,
enterprise: true,
description: 'Specifies the namespace the config entry will apply to.',
yaml: false,
},
2021-12-21 00:30:39 +00:00
{
name: 'Partition',
type: `string: "default"`,
enterprise: true,
description:
'Specifies the name of the admin partition in which the configuration entry applies. Refer to the [Admin Partitions documentation](/docs/enterprise/admin-partitions) for additional information.',
yaml: false,
},
2020-12-16 16:57:43 +00:00
{
name: 'Meta',
type: 'map<string|string>: nil',
description:
'Specifies arbitrary KV metadata pairs. Added in Consul 1.8.4.',
yaml: false,
},
{
name: 'metadata',
children: [
{
name: 'name',
description: 'Set to the name of the service being configured.',
},
2021-01-07 19:22:06 +00:00
{
name: 'namespace',
description:
'If running Consul Open Source, the namespace is ignored (see [Kubernetes Namespaces in Consul OSS](/docs/k8s/crds#consul-oss)). If running Consul Enterprise see [Kubernetes Namespaces in Consul Enterprise](/docs/k8s/crds#consul-enterprise) for more details.',
},
2021-12-21 00:30:39 +00:00
{
name: 'partition',
enterprise: true,
description:
'Specifies the admin partition in which the configuration will apply. The current partition is used if unspecified. Refer to the [Admin Partitions documentation](/docs/enterprise/admin-partitions) for details. The partitions parameter is not supported in Consul OSS.',
},
2020-12-16 16:57:43 +00:00
],
hcl: false,
},
{
name: 'Protocol',
type: `string: "tcp"`,
description: `Sets the protocol of the service. This is used
by Connect proxies for things like observability features and to unlock usage
2021-01-13 20:48:48 +00:00
of the [\`service-splitter\`](/docs/connect/config-entries/service-splitter) and
[\`service-router\`](/docs/connect/config-entries/service-router) config entries
2020-12-16 16:57:43 +00:00
for a service. It also unlocks the ability to define L7 intentions via
2021-01-13 20:48:48 +00:00
[\`service-intentions\`](/docs/connect/config-entries/service-intentions).
2020-12-16 16:57:43 +00:00
Supported values are one of \`tcp\`, \`http\`, \`http2\`, or \`grpc\`.`,
},
2021-04-16 19:50:02 +00:00
{
name: 'Mode',
type: `string: ""`,
2021-06-22 23:56:53 +00:00
description: `One of \`direct\` or \`transparent\`.
\`transparent\` represents that inbound and outbound application traffic is being
2021-04-16 19:50:02 +00:00
captured and redirected through the proxy. This mode does not enable the traffic redirection
itself. Instead it signals Consul to configure Envoy as if traffic is already being redirected.
2021-06-22 23:56:53 +00:00
\`direct\` represents that the proxy's listeners must be dialed directly by the local
2021-04-16 19:50:02 +00:00
application and other proxies.
Added in v1.10.0.`,
},
{
name: 'UpstreamConfig',
type: 'UpstreamConfiguration: <optional>',
description: `Controls default configuration settings that apply across all upstreams, and per-upstream
configuration overrides. Note that per-upstream configuration applies across all federated datacenters
2021-06-22 23:56:53 +00:00
to the pairing of source and upstream destination services.
2021-04-16 19:50:02 +00:00
Added in v1.10.0.`,
children: [
{
name: 'Overrides',
type: 'array<UpstreamConfig>: []',
description: `A list of optional overrides for per-upstream configuration.`,
children: [
2022-01-03 22:40:03 +00:00
{
name: 'Name',
type: 'string: ""',
description:
'The upstream name to apply the configuration to. This should not be set to the wildcard specifier `*`.',
},
{
name: 'Namespace',
type: 'string: ""',
description:
'The namespace of the upstream. This should not be set to the wildcard specifier `*`.',
},
{
name: 'Protocol',
type: 'string: ""',
description: `The protocol for the upstream listener.<br><br>
2021-04-16 19:50:02 +00:00
NOTE: The protocol of a service should ideally be configured via the
[\`protocol\`](/docs/connect/config-entries/service-defaults#protocol)
field of a
[\`service-defaults\`](/docs/connect/config-entries/service-defaults)
config entry for the upstream destination service. Configuring it in a
2021-11-02 21:21:15 +00:00
proxy upstream config will not fully enable some
2022-01-10 23:36:16 +00:00
[L7 features](/docs/connect/l7-traffic).
2021-04-16 19:50:02 +00:00
It is supported here for backwards compatibility with Consul versions prior to 1.6.0.
`,
2022-01-03 22:40:03 +00:00
},
{
name: 'ConnectTimeoutMs',
type: 'int: 5000',
description: {
hcl: `The number of milliseconds to allow when making upstream connections before timing out.<br><br>
2021-06-22 23:56:53 +00:00
NOTE: The connect timeout of a service should ideally be configured via the
[\`connect_timeout\`](/docs/connect/config-entries/service-resolver#connecttimeout)
field of a
[\`service-resolver\`](/docs/connect/config-entries/service-resolver)
config entry for the upstream destination service.
Configuring it in a proxy upstream config will not fully enable some
2022-01-10 23:36:16 +00:00
[L7 features](/docs/connect/l7-traffic).
2021-06-22 23:56:53 +00:00
It is supported here for backwards compatibility with Consul versions prior to 1.6.0.
`,
2022-01-03 22:40:03 +00:00
yaml: `The number of milliseconds to allow when making upstream connections before timing out.<br><br>
2021-06-22 23:56:53 +00:00
NOTE: The connect timeout of a service should ideally be configured via the
[\`connectTimeout\`](/docs/connect/config-entries/service-resolver#connecttimeout)
field of a
[\`ServiceResolver\`](/docs/connect/config-entries/service-resolver)
CRD for the upstream destination service.
Configuring it in a proxy upstream config will not fully enable some
2022-01-10 23:36:16 +00:00
[L7 features](/docs/connect/l7-traffic).
2021-06-22 23:56:53 +00:00
It is supported here for backwards compatibility with Consul versions prior to 1.6.0.
2021-06-23 02:18:13 +00:00
`,
2021-11-02 21:21:15 +00:00
},
2022-01-03 22:40:03 +00:00
},
{
name: 'MeshGateway',
type: 'MeshGatewayConfig: <optional>',
description: `Controls the default
2022-01-10 23:36:16 +00:00
[mesh gateway configuration](/docs/connect/gateways/mesh-gateway/service-to-service-traffic-datacenters#connect-proxy-configuration)
for this upstream.`,
2022-01-03 22:40:03 +00:00
children: [
{
name: 'Mode',
type: 'string: ""',
description: 'One of `none`, `local`, or `remote`.',
},
],
},
{
name: 'Limits',
type: 'Limits: <optional>',
description: `A set of limits to apply when connecting to the upstream service.
2021-06-23 02:18:13 +00:00
These limits are applied on a per-service-instance basis.
The following limits are respected.`,
2022-01-03 22:40:03 +00:00
children: [
{
name: 'MaxConnections',
type: 'int: 0',
description: `The maximum number of connections a service instance
2021-06-23 02:18:13 +00:00
will be allowed to establish against the given upstream. Use this to limit
HTTP/1.1 traffic, since HTTP/1.1 has a request per connection.`,
2022-01-03 22:40:03 +00:00
},
{
name: 'MaxPendingRequests',
type: 'int: 0',
description: `The maximum number of requests that will be queued
2021-06-23 02:18:13 +00:00
while waiting for a connection to be established. For this configuration to
be respected, a L7 protocol must be defined in the \`protocol\` field.`,
2022-01-03 22:40:03 +00:00
},
{
name: 'MaxConcurrentRequests',
type: 'int: 0',
description: `The maximum number of concurrent requests that
2021-06-23 02:18:13 +00:00
will be allowed at a single point in time. Use this to limit HTTP/2 traffic,
since HTTP/2 has many requests per connection. For this configuration to be
respected, a L7 protocol must be defined in the \`protocol\` field.`,
2022-01-03 22:40:03 +00:00
},
],
},
{
name: 'PassiveHealthCheck',
type: 'PassiveHealthCheck: <optional>',
description: `Passive health checks are used to remove hosts from
2021-04-16 19:50:02 +00:00
the upstream cluster which are unreachable or are returning errors..`,
2022-01-03 22:40:03 +00:00
children: [
{
name: 'Interval',
type: 'duration: 0s',
description: {
hcl: `The time between checks. Each check will cause hosts which
2021-06-23 02:18:13 +00:00
have exceeded \`max_failures\` to be removed from the load balancer, and
any hosts which have passed their ejection time to be returned to the
load balancer.`,
2022-01-03 22:40:03 +00:00
yaml: `The time between checks. Each check will cause hosts which
2021-06-23 02:18:13 +00:00
have exceeded \`maxFailures\` to be removed from the load balancer, and
any hosts which have passed their ejection time to be returned to the
load balancer.`,
2021-04-16 19:50:02 +00:00
},
2022-01-03 22:40:03 +00:00
},
{
name: 'MaxFailures',
type: 'int: 0',
description: `The number of consecutive failures which cause a host to be
2021-06-23 02:18:13 +00:00
removed from the load balancer.`,
2022-01-03 22:40:03 +00:00
},
],
},
],
2021-04-16 19:50:02 +00:00
},
{
name: 'Defaults',
type: 'UpstreamConfig: <optional>',
2021-11-02 21:21:15 +00:00
description: `Default configuration that applies to all upstreams of this service.`,
2021-04-16 19:50:02 +00:00
children: [
2021-06-22 23:56:53 +00:00
{
name: 'Protocol',
type: 'string: ""',
description: {
hcl: `The protocol for the upstream listener.<br><br>
NOTE: The protocol of a service should ideally be configured via the
[\`protocol\`](/docs/connect/config-entries/service-defaults#protocol)
field of a
[\`service-defaults\`](/docs/connect/config-entries/service-defaults)
config entry for the upstream destination service. Configuring it in a
proxy upstream config will not fully enable some
2022-01-10 23:36:16 +00:00
[L7 features](/docs/connect/l7-traffic).
2021-06-22 23:56:53 +00:00
It is supported here for backwards compatibility with Consul versions prior to 1.6.0.
`,
yaml: `The protocol for the upstream listener.<br><br>
NOTE: The protocol of a service should ideally be configured via the
[\`protocol\`](/docs/connect/config-entries/service-defaults#protocol)
field of a
[\`ServiceDefaults\`](/docs/connect/config-entries/service-defaults)
CRD for the upstream destination service. Configuring it in a
proxy upstream config will not fully enable some
2022-01-10 23:36:16 +00:00
[L7 features](/docs/connect/l7-traffic).
2021-06-22 23:56:53 +00:00
It is supported here for backwards compatibility with Consul versions prior to 1.6.0.
`,
2021-04-16 19:50:02 +00:00
},
2021-06-22 23:56:53 +00:00
},
{
name: 'ConnectTimeoutMs',
type: 'int: 5000',
description: {
hcl: `The number of milliseconds to allow when making upstream connections before timing out.<br><br>
NOTE: The connect timeout of a service should ideally be configured via the
[\`connect_timeout\`](/docs/connect/config-entries/service-resolver#connecttimeout)
field of a
[\`service-resolver\`](/docs/connect/config-entries/service-resolver)
config entry for the upstream destination service.
Configuring it in a proxy upstream config will not fully enable some
2022-01-10 23:36:16 +00:00
[L7 features](/docs/connect/l7-traffic).
2021-06-22 23:56:53 +00:00
It is supported here for backwards compatibility with Consul versions prior to 1.6.0.
`,
yaml: `The number of milliseconds to allow when making upstream connections before timing out.<br><br>
NOTE: The connect timeout of a service should ideally be configured via the
[\`connectTimeout\`](/docs/connect/config-entries/service-resolver#connecttimeout)
field of a
[\`ServiceResolver\`](/docs/connect/config-entries/service-resolver)
CRD for the upstream destination service.
Configuring it in a proxy upstream config will not fully enable some
2022-01-10 23:36:16 +00:00
[L7 features](/docs/connect/l7-traffic).
2021-06-22 23:56:53 +00:00
It is supported here for backwards compatibility with Consul versions prior to 1.6.0.
`,
2021-04-16 19:50:02 +00:00
},
2021-06-22 23:56:53 +00:00
},
{
name: 'MeshGateway',
type: 'MeshGatewayConfig: <optional>',
description: `Controls the default
2022-01-10 23:36:16 +00:00
[mesh gateway configuration](/docs/connect/gateways/mesh-gateway/service-to-service-traffic-datacenters#connect-proxy-configuration)
2021-04-16 19:50:02 +00:00
for this upstream.`,
2021-06-22 23:56:53 +00:00
children: [
{
name: 'Mode',
type: 'string: ""',
description: 'One of `none`, `local`, or `remote`.',
},
],
},
{
name: 'Limits',
type: 'Limits: <optional>',
description: `A set of limits to apply when connecting to the upstream service.
These limits are applied on a per-service-instance basis.
2021-04-16 19:50:02 +00:00
The following limits are respected.`,
2021-06-22 23:56:53 +00:00
children: [
{
name: 'MaxConnections',
type: 'int: 0',
description: `The maximum number of connections a service instance
2021-04-16 19:50:02 +00:00
will be allowed to establish against the given upstream. Use this to limit
HTTP/1.1 traffic, since HTTP/1.1 has a request per connection.`,
2021-06-22 23:56:53 +00:00
},
{
name: 'MaxPendingRequests',
type: 'int: 0',
description: `The maximum number of requests that will be queued
2021-04-16 19:50:02 +00:00
while waiting for a connection to be established. For this configuration to
be respected, a L7 protocol must be defined in the \`protocol\` field.`,
2021-06-22 23:56:53 +00:00
},
{
name: 'MaxConcurrentRequests',
type: 'int: 0',
description: `The maximum number of concurrent requests that
2021-04-16 19:50:02 +00:00
will be allowed at a single point in time. Use this to limit HTTP/2 traffic,
since HTTP/2 has many requests per connection. For this configuration to be
respected, a L7 protocol must be defined in the \`protocol\` field.`,
2021-06-22 23:56:53 +00:00
},
],
},
{
name: 'PassiveHealthCheck',
type: 'PassiveHealthCheck: <optional>',
description: `Passive health checks are used to remove hosts from
2021-04-16 19:50:02 +00:00
the upstream cluster which are unreachable or are returning errors..`,
2021-06-22 23:56:53 +00:00
children: [
{
name: 'Interval',
type: 'duration: 0s',
description: {
hcl: `The time between checks. Each check will cause hosts which
have exceeded \`max_failures\` to be removed from the load balancer, and
any hosts which have passed their ejection time to be returned to the
load balancer.`,
yaml: `The time between checks. Each check will cause hosts which
have exceeded \`maxFailures\` to be removed from the load balancer, and
any hosts which have passed their ejection time to be returned to the
load balancer.`,
2021-04-16 19:50:02 +00:00
},
2021-06-22 23:56:53 +00:00
},
{
name: 'MaxFailures',
type: 'int: 0',
description: `The number of consecutive failures which cause a host to be
2021-04-16 19:50:02 +00:00
removed from the load balancer.`,
2021-06-22 23:56:53 +00:00
},
],
},
2021-04-16 19:50:02 +00:00
],
2021-06-22 23:56:53 +00:00
},
2021-04-16 19:50:02 +00:00
],
},
{
name: 'TransparentProxy',
type: 'TransparentProxyConfig: <optional>',
description: `Controls configuration specific to proxies in transparent mode. Added in v1.10.0.`,
children: [
{
name: 'OutboundListenerPort',
type: 'int: "15001"',
2021-06-22 23:56:53 +00:00
description: `The port the proxy should listen on for outbound traffic. This must be the port where
2021-04-16 19:50:02 +00:00
outbound application traffic is redirected to.`,
},
2021-06-09 20:34:17 +00:00
{
name: 'DialedDirectly',
type: 'bool: false',
2021-06-22 23:56:53 +00:00
description: {
hcl: `Determines whether this proxy instance's IP address can be dialed directly by transparent proxies.
Typically transparent proxies dial upstreams using the "virtual" tagged address, which load balances
across instances. Dialing individual instances can be helpful in cases like stateful services such
as a database cluster with a leader.`,
yaml: `Determines whether the Pod IPs can be dialed directly (versus the Cluster IP).
Dialing Pod IPs can be helpful in cases like stateful services such
as a database cluster with a leader or with an ingress controller that dials Pod IPs instead of Cluster IPs.`,
},
2021-06-09 20:34:17 +00:00
},
2021-04-16 19:50:02 +00:00
],
},
2022-08-08 20:28:37 +00:00
{
name: 'Destination',
type: 'DestinationConfig: <optional>',
description: `Controls configuration specific to destinations through terminating-gateway. Added in v1.13.0.`,
children: [
{
name: 'Addresses',
type: 'array<string>: []',
description:`List of addresses associated with the destination. This can be a hostname or an IP address.
Wildcards are not accepted.`,
},
{
name: 'Port',
type: 'int: 0',
description: `Port number associated with the destination.`,
},
]
},
2022-08-19 18:11:21 +00:00
{
name: 'MaxInboundConnections',
description: 'The maximum number of concurrent inbound connections to each service instance.',
type: 'int: 0',
yaml: true,
},
2020-12-16 16:57:43 +00:00
{
name: 'MeshGateway',
type: 'MeshGatewayConfig: <optional>',
description: `Controls the default
2022-01-10 23:36:16 +00:00
[mesh gateway configuration](/docs/connect/gateways/mesh-gateway/service-to-service-traffic-datacenters#connect-proxy-configuration)
2020-12-16 16:57:43 +00:00
for this service. Added in v1.6.0.`,
children: [
{
name: 'Mode',
type: 'string: ""',
description: 'One of `none`, `local`, or `remote`.',
},
],
},
{
name: 'ExternalSNI',
type: 'string: ""',
description: `This is an optional setting that allows for
the TLS [SNI](https://en.wikipedia.org/wiki/Server_Name_Indication) value to
be changed to a non-connect value when federating with an external system.
Added in v1.6.0.`,
},
{
name: 'Expose',
type: 'ExposeConfig: <optional>',
description: `Controls the default
[expose path configuration](/docs/connect/registration/service-registration#expose-paths-configuration-reference)
for Envoy. Added in v1.6.2.<br><br>
Exposing paths through Envoy enables a service to protect itself by only listening on localhost, while still allowing
non-Connect-enabled applications to contact an HTTP endpoint.
Some examples include: exposing a \`/metrics\` path for Prometheus or \`/healthz\` for kubelet liveness checks.`,
children: [
{
name: 'Checks',
type: 'bool: false',
description: `If enabled, all HTTP and gRPC checks registered with the agent are exposed through Envoy.
Envoy will expose listeners for these checks and will only accept connections originating from localhost or Consul's
2022-01-11 01:30:50 +00:00
[advertise address](/docs/agent/config/config-files#advertise). The port for these listeners are dynamically allocated from
[expose_min_port](/docs/agent/config/config-files#expose_min_port) to [expose_max_port](/docs/agent/config/config-files#expose_max_port).
2020-12-16 16:57:43 +00:00
This flag is useful when a Consul client cannot reach registered services over localhost. One example is when running
Consul on Kubernetes, and Consul agents run in their own pods.`,
},
{
name: 'Paths',
type: 'array<Path>: []',
description: 'A list of paths to expose through Envoy.',
children: [
{
name: 'Path',
type: 'string: ""',
description:
'The HTTP path to expose. The path must be prefixed by a slash. ie: `/metrics`.',
},
{
name: 'LocalPathPort',
type: 'int: 0',
description:
'The port where the local service is listening for connections to the path.',
},
{
name: 'ListenerPort',
type: 'int: 0',
description: `The port where the proxy will listen for connections. This port must be available
for the listener to be set up. If the port is not free then Envoy will not expose a listener for the path,
but the proxy registration will not fail.`,
},
{
name: 'Protocol',
type: 'string: "http"',
description:
'Sets the protocol of the listener. One of `http` or `http2`. For gRPC use `http2`.',
},
],
},
],
2022-01-03 22:40:03 +00:00
},
2020-12-16 16:57:43 +00:00
]}
/>
2019-08-07 19:55:04 +00:00
2019-07-09 02:11:19 +00:00
## ACLs
2020-10-14 15:23:05 +00:00
Configuration entries may be protected by [ACLs](/docs/security/acl).
2019-07-09 02:11:19 +00:00
2020-10-14 15:23:05 +00:00
Reading a `service-defaults` config entry requires `service:read` on the resource.
2019-07-09 02:11:19 +00:00
Creating, updating, or deleting a `service-defaults` config entry requires
2020-10-14 15:23:05 +00:00
`service:write` on the resource.