Proxy Defaults
The proxy-defaults
config entry kind (ProxyDefaults
on Kubernetes) allows for configuring global config defaults across all services for Connect proxy configuration. Currently, only one global entry is supported.
Set the default protocol for all sidecar proxies:
Set the default protocol for all sidecar proxies:
HCL
- HCL
- Kubernetes YAML
- JSON
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
spec:
config:
protocol: http
{
"Kind": "proxy-defaults",
"Name": "global",
"Config": {
"protocol": "http"
}
}
Expose prometheus metrics:
HCL
- HCL
- Kubernetes YAML
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
spec:
config:
envoy_prometheus_bind_addr: '0.0.0.0:9102'
{
"Kind": "proxy-defaults",
"Name": "global",
"envoy_prometheus_bind_addr": "0.0.0.0:9102"
}
}
Set proxy-specific defaults:
HCL
- HCL
- Kubernetes YAML
- JSON
apiVersion: consul.hashicorp.com/v1alpha1
kind: ProxyDefaults
metadata:
name: global
spec:
config:
local_connect_timeout_ms: 1000
handshake_timeout_ms: 10000
"Kind": "proxy-defaults",
"Name": "global",
"Config": {
"local_connect_timeout_ms": 1000,
"handshake_timeout_ms": 10000
}
}
Kind - Must be set to
proxy-defaults
- Must be set to
global
Namespace
(string: "default")
Enterprise
- Specifies the namespace the config entry will apply to.
(map<string|string>: nil)
- Specifies arbitrary KV metadata pairs. Added in Consul 1.8.4.Config
(map[string]arbitrary)
- 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.(string: "")
- One ofdirect
or .transparent
represents that inbound and outbound application traffic is being 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.direct
represents that the proxy’s listeners must be dialed directly by the local application and other proxies. Added in v1.10.0.TransparentProxy
(TransparentProxyConfig: <optional>)
- Controls configuration specific to proxies in transparent mode. Added in v1.10.0.(int: "15001")
- The port the proxy should listen on for outbound traffic. This must be the port where outbound application traffic is captured and redirected to.
MeshGateway
(MeshGatewayConfig: <optional>)
- Controls the default for all proxies. Added in v1.6.0.- Mode
(string: "")
- One ofnone
,local
, orremote
.
- Mode
(ExposeConfig: <optional>)
- Controls the default expose path configuration for Envoy. Added in v1.6.2.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.(bool: false)
- 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 advertise address. The port for these listeners are dynamically allocated from to expose_max_port. This flag is useful when a Consul client cannot reach registered services over localhost.(array<Path>: [])
- A list of paths to expose through Envoy.
Configuration entries may be protected by .
Reading a proxy-defaults
config entry requires no specific privileges.
Creating, updating, or deleting a proxy-defaults
config entry requires operator:write
.