2019-07-09 02:11:19 +00:00
---
2020-04-07 18:55:19 +00:00
layout: docs
2022-09-16 15:28:32 +00:00
page_title: Proxy Defaults - Configuration Entry Reference
2020-04-07 18:55:19 +00:00
description: >-
2023-01-11 16:41:02 +00:00
The proxy defaults configuration entry kind defines default behaviors for proxies in the service mesh. Use the reference guide to learn about `""proxy-defaults""` config entry parameters.
2019-07-09 02:11:19 +00:00
---
2022-09-13 21:04:13 +00:00
# Proxy Defaults Configuration Entry
2020-12-16 16:57:43 +00:00
2023-01-11 16:41:02 +00:00
The `proxy-defaults` configuration entry (`ProxyDefaults` on Kubernetes) allows you to globally configure passthrough Envoy settings for proxies in the service mesh, including both sidecars and gateways.
It is different from the [`mesh` configuration entry](/docs/connect/config-entries/mesh), which sets Consul features for cluster peering, transparent proxy, and TLS behavior that also affect Consul servers.
Only one global entry is supported.
For Consul Enterprise, only the global entry in the `default` partition is recognized.
2019-07-09 02:11:19 +00:00
2022-01-20 21:35:27 +00:00
## Introduction
2019-07-09 02:11:19 +00:00
2023-01-11 16:41:02 +00:00
You can customize some service registration settings for service mesh proxies centrally using the `proxy-defaults` configuration entry in the `kind` field.
2022-01-20 21:35:27 +00:00
You can still override this centralized configuration for specific services
with the [`service-defaults`](/docs/connect/config-entries/service-defaults)
configuration entry `kind` or for individual proxy instances in their [sidecar
service definitions](/docs/connect/registration/sidecar-service).
## Requirements
The following Consul binaries are supported:
2022-08-23 19:14:36 +00:00
* Consul 1.8.4+ on Kubernetes.
* Consul 1.5.0+ on other platforms.
2022-01-20 21:35:27 +00:00
## Usage
2020-12-16 16:57:43 +00:00
2022-01-20 21:35:27 +00:00
1. Verify that your datacenter meets the conditions specified in the [Requirements](#requirements).
1. Determine the settings you want to implement (see [Configuration](#configuration)). You can create a file containing the configuration or pass them to the state store directly to apply the configuration.
1. Apply the configuration using one of the following methods:
- Kubernetes CRD: Refer to the [Custom Resource Definitions](/docs/k8s/crds) documentation for details.
- Issue the `consul config write` command: Refer to the [Consul Config Write](/commands/config/write) documentation for details.
## Configuration
Configure the following parameters to define a `proxy-defaults` configuration entry:
2021-06-13 00:53:50 +00:00
2020-12-16 16:57:43 +00:00
<Tabs>
2021-06-13 00:53:50 +00:00
<Tab heading="Consul OSS">
2020-12-16 16:57:43 +00:00
2022-01-20 21:35:27 +00:00
<CodeTabs heading="Proxy defaults configuration syntax" tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
2021-06-13 00:53:50 +00:00
2019-07-09 02:11:19 +00:00
```hcl
2020-06-16 18:28:21 +00:00
Kind = "proxy-defaults"
Name = "global"
2022-01-20 21:35:27 +00:00
Meta {
<arbitrary string key> = "<arbitrary string value>"
}
2020-06-16 18:28:21 +00:00
Config {
2022-01-20 21:35:27 +00:00
<arbitrary string key> = <arbitrary value>
}
Mode = "<name of proxy mode>"
TransparentProxy {
OutboundListenerPort = <port the proxy should listen on for outbound traffic>
DialedDirectly = <true if proxy instances should be dialed directly>
}
MeshGateway {
2022-05-10 14:28:33 +00:00
Mode = "<name of mesh gateway configuration for all proxies>"
2022-01-20 21:35:27 +00:00
}
Expose {
Checks = <true to expose all HTTP and gRPC checks through Envoy>
Paths = [
{
Path = "<the HTTP path to expose>"
LocalPathPort = <port where the local service is listening for connections to the path>
ListenerPort = <port where the proxy will listen for connections>
Protocol = "<protocol of the listener>"
}
]
2019-07-09 02:11:19 +00:00
}
2023-01-11 16:41:02 +00:00
AccessLogs {
Enabled = < true | false >
DisableListenerLogs = < true | false , disables listener access logs for unrecognized traffic>
Type = "< file | stdout | stdout, the destination for access logs >"
Path = "< set the output path for 'file' based access logs >"
JSONFormat = "< json representation of access log format >"
TextFormat = "< text representation of access log format >"
}
2019-07-09 02:11:19 +00:00
```
2021-06-13 00:53:50 +00:00
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
spec:
2022-01-20 21:35:27 +00:00
meta:
<arbitrary string key>: <arbitrary string value>
2021-06-13 00:53:50 +00:00
config:
2022-01-20 21:35:27 +00:00
<arbitrary string key>: <arbitrary value>
mode: <name of proxy mode>
transparentProxy:
outboundListenerPort: <port the proxy should listen on for outbound traffic>
dialedDirectly: <true if proxy instances should be dialed directly>
meshGateway:
2022-05-10 14:28:33 +00:00
mode: <name of mesh gateway configuration for all proxies>
2022-01-20 21:35:27 +00:00
expose:
checks: <true to expose all HTTP and gRPC checks through Envoy>
paths:
- path: <the HTTP path to expose>
localPathPort: <port where the local service is listening for connections to the path>
listenerPort: <port where the proxy will listen for connections>
protocol:= <protocol of the listener>
2023-01-11 16:41:02 +00:00
accessLogs:
enabled: < true | false >
disableListenerLogs: < true | false , disables listener access logs for unrecognized traffic>
type: < file | stdout | stdout, the destination for access logs >
path: < set the output path for 'file' based access logs >
jsonFormat: < json representation of access log format >
textFormat: < text representation of access log format >
2021-06-13 00:53:50 +00:00
```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
2022-01-20 21:35:27 +00:00
"Meta": {
"<arbitrary string key>": "<arbitrary string value>"
},
2021-06-13 00:53:50 +00:00
"Config": {
2022-01-20 21:35:27 +00:00
"<arbitrary string key>": <arbitrary value>
},
"Mode": "<name of proxy mode>",
"TransparentProxy": {
"OutboundListenerPort": <port the proxy should listen on for outbound traffic>,
"DialedDirectly": <true if proxy instances should be dialed directly>
},
"MeshGateway": {
2022-05-10 14:28:33 +00:00
"Mode": = "<name of mesh gateway configuration for all proxies>"
2022-01-20 21:35:27 +00:00
},
"Expose": {
"Checks": <true to expose all HTTP and gRPC checks through Envoy>,
"Paths": [
{
"Path": "<the HTTP path to expose>",
"LocalPathPort": <port where the local service is listening for connections to the path>,
"ListenerPort": <port where the proxy will listen for connections>,
"Protocol": "<protocol of the listener>"
}
]
2023-01-11 16:41:02 +00:00
},
"AccessLogs": {
"Enabled": < true | false >,
"DisableListenerLogs": < true | false , disables listener access logs for unrecognized traffic>,
"Type": "< file | stdout | stdout, the destination for access logs >",
"Path": "< set the output path for 'file' based access logs >",
"JSONFormat": "< json representation of access log format >",
"TextFormat": "< text representation of access log format >"
2021-06-13 00:53:50 +00:00
}
}
```
2020-12-16 16:57:43 +00:00
2021-06-13 00:53:50 +00:00
</CodeTabs>
2020-12-16 16:57:43 +00:00
2021-06-13 00:53:50 +00:00
</Tab>
<Tab heading="Consul Enterprise">
-> **NOTE:** The `proxy-defaults` config entry can only be created in the `default`
2020-12-16 16:57:43 +00:00
namespace and it will configure proxies in **all** namespaces.
2019-07-09 02:11:19 +00:00
2022-01-20 21:35:27 +00:00
<CodeTabs heading="Proxy defaults configuration syntax" tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
2021-06-13 00:53:50 +00:00
2019-07-09 02:11:19 +00:00
```hcl
2020-12-16 16:57:43 +00:00
Kind = "proxy-defaults"
Name = "global"
Namespace = "default" # Can only be set to "default".
2022-01-20 21:35:27 +00:00
Meta {
<arbitrary string key> = "<arbitrary string value>"
}
2020-06-16 18:28:21 +00:00
Config {
2022-01-20 21:35:27 +00:00
<arbitrary string key> = <arbitrary value>
2019-07-09 02:11:19 +00:00
}
2022-01-20 21:35:27 +00:00
Mode = "<name of proxy mode>"
TransparentProxy {
OutboundListenerPort = <port the proxy should listen on for outbound traffic>
DialedDirectly = <true if proxy instances should be dialed directly>
2021-06-13 00:53:50 +00:00
}
2022-01-20 21:35:27 +00:00
MeshGateway {
2022-05-10 14:28:33 +00:00
Mode = "<name of mesh gateway configuration for all proxies>"
2021-01-27 01:19:30 +00:00
}
2022-01-20 21:35:27 +00:00
Expose {
Checks = <true to expose all HTTP and gRPC checks through Envoy>
2021-01-27 01:19:30 +00:00
2022-01-20 21:35:27 +00:00
Paths = [
{
Path = "<the HTTP path to expose>"
LocalPathPort = <port where the local service is listening for connections to the path>
ListenerPort = <port where the proxy will listen for connections>
Protocol = "<protocol of the listener>"
}
]
2021-06-13 00:53:50 +00:00
}
2023-01-11 16:41:02 +00:00
AccessLogs {
Enabled = < true | false >
DisableListenerLogs = < true | false , disables listener access logs for unrecognized traffic>
Type = "< file | stdout | stdout, the destination for access logs >"
Path = "< set the output path for 'file' based access logs >"
JSONFormat = "< json representation of access log format >"
TextFormat = "< text representation of access log format >"
}
2021-06-13 00:53:50 +00:00
```
2021-01-27 01:19:30 +00:00
2020-12-16 16:57:43 +00:00
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
2022-01-20 21:35:27 +00:00
namespace: default
2020-12-16 16:57:43 +00:00
spec:
2022-01-20 21:35:27 +00:00
meta:
<arbitrary string key>: <arbitrary string value>
2020-12-16 16:57:43 +00:00
config:
2022-01-20 21:35:27 +00:00
<arbitrary string key>: <arbitrary value>
mode: <name of proxy mode>
transparentProxy:
outboundListenerPort: <port the proxy should listen on for outbound traffic>
dialedDirectly: <true if proxy instances should be dialed directly>
meshGateway:
2022-05-10 14:28:33 +00:00
mode: <name of mesh gateway configuration for all proxies>
2022-01-20 21:35:27 +00:00
expose:
checks: <true to expose all HTTP and gRPC checks through Envoy>
paths:
- path: <the HTTP path to expose>
localPathPort: <port where the local service is listening for connections to the path>
listenerPort: <port where the proxy will listen for connections>
protocol:= <protocol of the listener>
2023-01-11 16:41:02 +00:00
accessLogs:
enabled: < true | false >
disableListenerLogs: < true | false , disables listener access logs for unrecognized traffic>
type: < file | stdout | stdout, the destination for access logs >
path: < set the output path for 'file' based access logs >
jsonFormat: < json representation of access log format >
textFormat: < text representation of access log format >
2020-12-16 16:57:43 +00:00
```
2020-04-06 20:27:35 +00:00
2021-06-13 00:53:50 +00:00
```json
{
"Kind": "proxy-defaults",
"Name": "global",
2022-01-20 21:35:27 +00:00
"Namespace": "default",
"Meta": {
"<arbitrary string key>": "<arbitrary string value>"
},
2021-06-13 00:53:50 +00:00
"Config": {
2022-01-20 21:35:27 +00:00
"<arbitrary string key>": <arbitrary value>
},
"Mode": "<name of proxy mode>",
"TransparentProxy": {
"OutboundListenerPort": <port the proxy should listen on for outbound traffic>,
"DialedDirectly": <true if proxy instances should be dialed directly>
},
"MeshGateway": {
2022-05-10 14:28:33 +00:00
"Mode": = "<name of mesh gateway configuration for all proxies>"
2022-01-20 21:35:27 +00:00
},
"Expose": {
"Checks": <true to expose all HTTP and gRPC checks through Envoy>,
"Paths": [
{
"Path": "<the HTTP path to expose>",
"LocalPathPort": <port where the local service is listening for connections to the path>,
"ListenerPort": <port where the proxy will listen for connections>,
"Protocol": "<protocol of the listener>"
}
]
2023-01-11 16:41:02 +00:00
},
"AccessLogs": {
"Enabled": < true | false >,
"DisableListenerLogs": < true | false , disables listener access logs for unrecognized traffic>,
"Type": "< file | stdout | stdout, the destination for access logs >",
"Path": "< set the output path for 'file' based access logs >",
"JSONFormat": "< json representation of access log format >",
"TextFormat": "< text representation of access log format >"
2021-06-13 00:53:50 +00:00
}
}
```
</CodeTabs>
2019-09-26 02:55:52 +00:00
2022-01-20 21:35:27 +00:00
</Tab>
</Tabs>
### Configuration Parameters
2020-03-09 20:51:21 +00:00
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 `proxy-defaults`',
yaml: 'Must be set to `ProxyDefaults`',
},
},
{
name: 'Name',
description: 'Must be set to `global`',
yaml: false,
},
{
name: 'Namespace',
type: `string: "default"`,
enterprise: true,
2022-01-14 17:51:57 +00:00
description:
'Must be set to `default`. The configuration will apply to all namespaces.',
2021-12-21 00:30:39 +00:00
yaml: false,
},
{
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.',
2020-12-16 16:57:43 +00:00
yaml: false,
},
{
name: 'Meta',
type: 'map<string|string>: nil',
description:
'Specifies arbitrary KV metadata pairs. Added in Consul 1.8.4.',
yaml: false,
},
{
name: 'metadata',
2021-01-07 19:22:06 +00:00
children: [
{
name: 'name',
description: 'Must be set to `global`',
},
{
name: 'namespace',
2021-12-21 00:30:39 +00:00
enterprise: true,
2021-01-07 19:22:06 +00:00
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.',
},
],
2020-12-16 16:57:43 +00:00
hcl: false,
},
{
name: 'Config',
type: 'map[string]arbitrary',
description: `An arbitrary map of configuration values used by Connect proxies.
The available configurations depend on the Connect proxy you use.
Any values that your proxy allows can be configured globally here. To explore these options please see the documentation for your chosen proxy.
2021-06-13 00:53:50 +00:00
<ul><li>[Envoy](/docs/connect/proxies/envoy#proxy-config-options)</li>
<li>[Consul's built-in proxy](/docs/connect/proxies/built-in#proxy-config-key-reference)</li></ul>`,
2020-12-16 16:57:43 +00:00
},
2022-12-19 20:19:37 +00:00
{
name: 'EnvoyExtensions',
type: 'array<EnvoyExtension>: []',
description: `A list of extensions to modify Envoy proxy configuration.`,
children: [
{
name: 'Name',
type: `string: ""`,
description: `Name of the extension.`,
},
{
name: 'Required',
type: `string: ""`,
description: `When \`Required\` is true and the extension does not update any Envoy resources, an error is
returned. Use this parameter to ensure that extensions required for secure communication are not unintentionally
bypassed.`,
},
{
name: 'Arguments',
type: 'map<string|Any>: nil',
description: `Arguments to pass to the extension executable.`,
},
],
},
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: '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 captured and redirected to.`,
},
2021-06-09 20:34:17 +00:00
{
name: 'DialedDirectly',
type: 'bool: false',
2021-06-22 23:56:53 +00:00
description: `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
2021-06-09 20:34:17 +00:00
as a database cluster with a leader. `,
},
2021-04-16 19:50:02 +00:00
],
},
2020-12-16 16:57:43 +00:00
{
name: 'MeshGateway',
type: 'MeshGatewayConfig: <optional>',
description: `Controls the default
2022-11-14 20:03:17 +00:00
[mesh gateway configuration](/docs/connect/gateways/mesh-gateway#connect-proxy-configuration)
2020-12-16 16:57:43 +00:00
for all proxies. Added in v1.6.0.`,
children: [
{
name: 'Mode',
type: 'string: ""',
description: 'One of `none`, `local`, or `remote`.',
},
],
},
{
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).
2021-06-22 23:56:53 +00:00
This flag is useful when a Consul client cannot reach registered services over localhost.`,
2020-12-16 16:57:43 +00:00
},
{
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`.',
},
],
},
],
},
2023-01-11 16:41:02 +00:00
{
name: 'AccessLogs',
type: 'AccessLogsConfig: <optional>',
description: `Controls the configuration of [Envoy's access logging](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/observability/access_logging.html?highlight=access%20logs)
for all proxies in the mesh, including gateways. It also configures access logs on [Envoy's administration interface](https://www.envoyproxy.io/docs/envoy/latest/operations/admin.html?highlight=administration%20logs).`,
children: [
{
name: 'Enabled',
type: 'bool: false',
description: 'When enabled, access logs are emitted for all proxies in the mesh, including gateways.',
},
{
name: 'DisableListenerLogs',
type: 'bool: false',
description: `When enabled, access logs for traffic rejected at the listener-level are not emitted.
This traffic includes connections that do not match any of Envoy's configured filters, such as Consul upstream services.
Set this option to \`true\` if you do not want to log unknown requests that Envoy is not forwarding`,
},
{
name: 'Type',
type: 'string: "stdout"',
description: 'The destination for access logs. One of \`stdout\`, \`stderr\`, or \`file\`.',
},
{
name: 'Path',
type: 'string: ""',
description: 'The destination file for access logs. Only valid with \`Type\` set to \`file\`.',
},
{
name: 'JSONFormat',
type: 'string: (default as follows)',
description: `A JSON-formatted string that represents the format of each emitted access log.
By default, it is set to the [default access log format](/consul/docs/connect/observability/access-logs#default-log-format).
You can use Envoy [command operators](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#command-operators) to customize the emitted data.
Nesting is supported.
Invalid if a custom format is specified with TextFormat.`,
},
{
name: 'TextFormat',
type: 'string: ""',
description: `A formatted string that represents the format of each emitted access log.
Envoy [command operators](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#command-operators) can be used to customize the data emitted.
A new line is added to the string automatically.
Invalid when a custom JSONFormat is already specified.`,
}
],
},
2020-12-16 16:57:43 +00:00
]}
/>
2019-07-09 02:25:25 +00:00
2022-01-20 21:35:27 +00:00
## Examples
### Default protocol
2023-01-11 16:41:02 +00:00
The following example configures the default protocol for all proxies.
2022-01-20 21:35:27 +00:00
<Tabs>
<Tab heading="Consul OSS">
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
```hcl
Kind = "proxy-defaults"
Name = "global"
Config {
protocol = "http"
}
```
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
spec:
config:
protocol: http
```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"Config": {
"protocol": "http"
}
}
```
</CodeTabs>
</Tab>
<Tab heading="Consul Enterprise">
-> **NOTE:** The `proxy-defaults` config entry can only be created in the `default`
namespace and it will configure proxies in **all** namespaces.
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
```hcl
Kind = "proxy-defaults"
Name = "global"
Namespace = "default" # Can only be set to "default".
Config {
protocol = "http"
}
```
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
namespace: default
spec:
config:
protocol: http
```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"Namespace": "default",
"Config": {
"protocol": "http"
}
}
```
</CodeTabs>
</Tab>
</Tabs>
### Prometheus
2023-01-11 16:41:02 +00:00
The following example configures all proxies to expose Prometheus metrics.
2022-01-20 21:35:27 +00:00
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
```hcl
Kind = "proxy-defaults"
Name = "global"
Config {
envoy_prometheus_bind_addr = "0.0.0.0:9102"
}
```
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
spec:
config:
envoy_prometheus_bind_addr: '0.0.0.0:9102'
```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"Config": {
"envoy_prometheus_bind_addr": "0.0.0.0:9102"
}
}
```
</CodeTabs>
2023-01-11 16:41:02 +00:00
### Access Logs
The following example is a minimal configuration for enabling access logs for all proxies.
Refer to [access logs](/docs/connect/observability/access-logs) for advanced configurations.
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
```hcl
Kind = "proxy-defaults"
Name = "global"
AccessLogs {
Enabled = true
}
```
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
spec:
accessLogs:
enabled: true
```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"AccessLogs": {
"Enabled": true
}
}
```
</CodeTabs>
2022-01-20 21:35:27 +00:00
### Proxy-specific defaults
2023-01-11 16:41:02 +00:00
The following example configures some custom default values for all proxies.
2022-01-20 21:35:27 +00:00
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
```hcl
Kind = "proxy-defaults"
Name = "global"
Config {
local_connect_timeout_ms = 1000
handshake_timeout_ms = 10000
}
```
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
spec:
config:
local_connect_timeout_ms: 1000
handshake_timeout_ms: 10000
```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"Config": {
"local_connect_timeout_ms": 1000,
"handshake_timeout_ms": 10000
}
}
```
</CodeTabs>
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
Reading a `proxy-defaults` config entry requires no specific privileges.
Creating, updating, or deleting a `proxy-defaults` config entry requires
`operator:write`.