github.com/projectcontour/contour@v1.28.2/site/content/docs/1.20/configuration.md (about) 1 # Contour Configuration Reference 2 3 - [Serve Flags](#serve-flags) 4 - [Configuration File](#configuration-file) 5 - [Environment Variables](#environment-variables) 6 - [Bootstrap Config File](#bootstrap-config-file) 7 8 ## Overview 9 10 There are various ways to configure Contour, flags, the configuration file, as well as environment variables. 11 Contour has a precedence of configuration for contour serve, meaning anything configured in the config file is overridden by environment vars which are overridden by cli flags. 12 13 ## Serve Flags 14 15 The `contour serve` command is the main command which is used to watch for Kubernetes resource and process them into Envoy configuration which is then streamed to any Envoy via its xDS gRPC connection. 16 There are a number of flags that can be passed to this command which further configures how Contour operates. 17 Many of these flags are mirrored in the [Contour Configuration File](#configuration-file). 18 19 | Flag Name | Description | 20 | -------------------------------------------------------- | ---------------------------------------------------------------------- | 21 | `--config-path` | Path to base configuration | 22 | `--contour-config-name` | Name of the ContourConfiguration resource to use | 23 | `--incluster` | Use in cluster configuration | 24 | `--kubeconfig=</path/to/file>` | Path to kubeconfig (if not in running inside a cluster) | 25 | `--xds-address=<ipaddr>` | xDS gRPC API address | 26 | `--xds-port=<port>` | xDS gRPC API port | 27 | `--stats-address=<ipaddr>` | Envoy /stats interface address | 28 | `--stats-port=<port>` | Envoy /stats interface port | 29 | `--debug-http-address=<address>` | Address the debug http endpoint will bind to. | 30 | `--debug-http-port=<port>` | Port the debug http endpoint will bind to | 31 | `--http-address=<ipaddr>` | Address the metrics HTTP endpoint will bind to | 32 | `--http-port=<port>` | Port the metrics HTTP endpoint will bind to. | 33 | `--health-address=<ipaddr>` | Address the health HTTP endpoint will bind to | 34 | `--health-port=<port>` | Port the health HTTP endpoint will bind to | 35 | `--contour-cafile=</path/to/file\|CONTOUR_CERT_FILE>` | CA bundle file name for serving gRPC with TLS | 36 | `--contour-cert-file=</path/to/file\|CONTOUR_CERT_FILE>` | Contour certificate file name for serving gRPC over TLS | 37 | `--contour-key-file=</path/to/file\|CONTOUR_KEY_FILE>` | Contour key file name for serving gRPC over TLS | 38 | `--insecure` | Allow serving without TLS secured gRPC | 39 | `--root-namespaces=<ns,ns>` | Restrict contour to searching these namespaces for root ingress routes | 40 | `--ingress-class-name=<name>` | Contour IngressClass name | 41 | `--ingress-status-address=<address>` | Address to set in Ingress object status | 42 | `--envoy-http-access-log=</path/to/file>` | Envoy HTTP access log | 43 | `--envoy-https-access-log=</path/to/file>` | Envoy HTTPS access log | 44 | `--envoy-service-http-address=<ipaddr>` | Kubernetes Service address for HTTP requests | 45 | `--envoy-service-https-address=<ipaddr>` | Kubernetes Service address for HTTPS requests | 46 | `--envoy-service-http-port=<port>` | Kubernetes Service port for HTTP requests | 47 | `--envoy-service-https-port=<port>` | Kubernetes Service port for HTTPS requests | 48 | `--envoy-service-name=<name>` | Name of the Envoy service to inspect for Ingress status details. | 49 | `--envoy-service-namespace=<namespace>` | Envoy Service Namespace | 50 | `--use-proxy-protocol` | Use PROXY protocol for all listeners | 51 | `--accesslog-format=<envoy\|json>` | Format for Envoy access logs | 52 | `--disable-leader-election` | Disable leader election mechanism | 53 | `--leader-election-lease-duration` | The duration of the leadership lease. | 54 | `--leader-election-renew-deadline` | The duration leader will retry refreshing leadership before giving up. | 55 | `--leader-election-retry-period` | The interval which Contour will attempt to acquire leadership lease. | 56 | `--leader-election-resource-name` | The name of the resource (ConfigMap) leader election will lease. | 57 | `--leader-election-resource-namespace` | The namespace of the resource (ConfigMap) leader election will lease. | 58 | `-d, --debug` | Enable debug logging | 59 | `--kubernetes-debug=<log level>` | Enable Kubernetes client debug logging | 60 61 ## Configuration File 62 63 A configuration file can be passed to the `--config-path` argument of the `contour serve` command to specify additional configuration to Contour. 64 In most deployments, this file is passed to Contour via a ConfigMap which is mounted as a volume to the Contour pod. 65 66 The Contour configuration file is optional. 67 In its absence, Contour will operate with reasonable defaults. 68 Where Contour settings can also be specified with command-line flags, the command-line value takes precedence over the configuration file. 69 70 | Field Name | Type | Default | Description | 71 | ------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 72 | accesslog-format | string | `envoy` | This key sets the global [access log format][2] for Envoy. Valid options are `envoy` or `json`. | 73 | accesslog-format-string | string | None | If present, this specifies custom access log format for Envoy. See [Envoy documentation](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage) for more information about the syntax. This field only has effect if `accesslog-format` is `envoy` | 74 | debug | boolean | `false` | Enables debug logging. | 75 | default-http-versions | string array | <code style="white-space:nowrap">HTTP/1.1</code> <br> <code style="white-space:nowrap">HTTP/2</code> | This array specifies the HTTP versions that Contour should program Envoy to serve. HTTP versions are specified as strings of the form "HTTP/x", where "x" represents the version number. | 76 | disableAllowChunkedLength | boolean | `false` | If this field is true, Contour will disable the RFC-compliant Envoy behavior to strip the `Content-Length` header if `Transfer-Encoding: chunked` is also set. This is an emergency off-switch to revert back to Envoy's default behavior in case of failures. | 77 | disablePermitInsecure | boolean | `false` | If this field is true, Contour will ignore `PermitInsecure` field in HTTPProxy documents. | 78 | envoy-service-name | string | `envoy` | This sets the service name that will be inspected for address details to be applied to Ingress objects. | 79 | envoy-service-namespace | string | `projectcontour` | This sets the namespace of the service that will be inspected for address details to be applied to Ingress objects. If the `CONTOUR_NAMESPACE` environment variable is present, Contour will populate this field with its value. | 80 | ingress-status-address | string | None | If present, this specifies the address that will be copied into the Ingress status for each Ingress that Contour manages. It is exclusive with `envoy-service-name` and `envoy-service-namespace`. | 81 | incluster | boolean | `false` | This field specifies that Contour is running in a Kubernetes cluster and should use the in-cluster client access configuration. | 82 | json-fields | string array | [fields][5] | This is the list the field names to include in the JSON [access log format][2]. This field only has effect if `accesslog-format` is `json`. | 83 | kubeconfig | string | `$HOME/.kube/config` | Path to a Kubernetes [kubeconfig file][3] for when Contour is executed outside a cluster. | 84 | leaderelection | leaderelection | | The [leader election configuration](#leader-election-configuration). | 85 | policy | PolicyConfig | | The default [policy configuration](#policy-configuration). | 86 | tls | TLS | | The default [TLS configuration](#tls-configuration). | 87 | timeouts | TimeoutConfig | | The [timeout configuration](#timeout-configuration). | 88 | cluster | ClusterConfig | | The [cluster configuration](#cluster-configuration). | 89 | network | NetworkConfig | | The [network configuration](#network-configuration). | 90 | listener | ListenerConfig | | The [listener configuration](#listener-configuration). | 91 | server | ServerConfig | | The [server configuration](#server-configuration) for `contour serve` command. | 92 | gateway | GatewayConfig | | The [gateway-api Gateway configuration](#gateway-configuration). | 93 | rateLimitService | RateLimitServiceConfig | | The [rate limit service configuration](#rate-limit-service-configuration). | 94 | enableExternalNameService | boolean | `false` | Enable ExternalName Service processing. Enabling this has security implications. Please see the [advisory](https://github.com/projectcontour/contour/security/advisories/GHSA-5ph6-qq5x-7jwc) for more details. | 95 | metrics | MetricsParameters | | The [metrics configuration](#metrics-configuration) | 96 97 ### TLS Configuration 98 99 The TLS configuration block can be used to configure default values for how 100 Contour should provision TLS hosts. 101 102 | Field Name | Type | Default | Description | 103 | ------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 104 | minimum-protocol-version | string | `1.2` | This field specifies the minimum TLS protocol version that is allowed. Valid options are `1.2` (default) and `1.3`. Any other value defaults to TLS 1.2. | 105 | fallback-certificate | | | [Fallback certificate configuration](#fallback-certificate). | 106 | envoy-client-certificate | | | [Client certificate configuration for Envoy](#envoy-client-certificate). | 107 | cipher-suites | []string | See [config package documentation](https://pkg.go.dev/github.com/projectcontour/contour/pkg/config#pkg-variables) | This field specifies the TLS ciphers to be supported by TLS listeners when negotiating TLS 1.2. This parameter should only be used by advanced users. Note that this is ignored when TLS 1.3 is in use. The set of ciphers that are allowed is a superset of those supported by default in stock, non-FIPS Envoy builds and FIPS builds as specified [here](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/transport_sockets/tls/v3/common.proto#envoy-v3-api-field-extensions-transport-sockets-tls-v3-tlsparameters-cipher-suites). Custom ciphers not accepted by Envoy in a standard build are not supported. | 108 109 ### Fallback Certificate 110 111 | Field Name | Type | Default | Description | 112 | ---------- | ------ | ------- | ----------------------------------------------------------------------------------------------- | 113 | name | string | `""` | This field specifies the name of the Kubernetes secret to use as the fallback certificate. | 114 | namespace | string | `""` | This field specifies the namespace of the Kubernetes secret to use as the fallback certificate. | 115 116 117 ### Envoy Client Certificate 118 119 | Field Name | Type | Default | Description | 120 | ---------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 121 | name | string | `""` | This field specifies the name of the Kubernetes secret to use as the client certificate and private key when establishing TLS connections to the backend service. | 122 | namespace | string | `""` | This field specifies the namespace of the Kubernetes secret to use as the client certificate and private key when establishing TLS connections to the backend service. | 123 124 ### Leader Election Configuration 125 126 The leader election configuration block configures how a deployment with more than one Contour pod elects a leader. 127 The Contour leader is responsible for updating the status field on Ingress and HTTPProxy documents. 128 In the vast majority of deployments, only the `configmap-name` and `configmap-namespace` fields should require any configuration. 129 130 _Note:_ Configuring leader election via the configuration file is deprecated, please use the `contour serve` command line flags instead. 131 132 | Field Name | Type | Default | Description | 133 | ------------------- | ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 134 | configmap-name | string | `leader-elect` | The name of the ConfigMap that Contour leader election will lease. | 135 | configmap-namespace | string | `projectcontour` | The namespace of the ConfigMap that Contour leader election will lease. If the `CONTOUR_NAMESPACE` environment variable is present, Contour will populate this field with its value. | 136 | lease-duration | [duration][4] | `15s` | The duration of the leadership lease. | 137 | renew-deadline | [duration][4] | `10s` | The length of time that the leader will retry refreshing leadership before giving up. | 138 | retry-period | [duration][4] | `2s` | The interval at which Contour will attempt to the acquire leadership lease. | 139 140 ### Timeout Configuration 141 142 The timeout configuration block can be used to configure various timeouts for the proxies. All fields are optional; Contour/Envoy defaults apply if a field is not specified. 143 144 | Field Name | Type | Default | Description | 145 | -------------------------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 146 | request-timeout | string | none* | This field specifies the default request timeout. Note that this is a timeout for the entire request, not an idle timeout. Must be a [valid Go duration string][4], or omitted or set to `infinity` to disable the timeout entirely. See [the Envoy documentation][12] for more information.<br /><br />_Note: A value of `0s` previously disabled this timeout entirely. This is no longer the case. Use `infinity` or omit this field to disable the timeout._ | 147 | connection-idle-timeout | string | `60s` | This field defines how long the proxy should wait while there are no active requests (for HTTP/1.1) or streams (for HTTP/2) before terminating an HTTP connection. The timeout applies to downstream connections only. Must be a [valid Go duration string][4], or `infinity` to disable the timeout entirely. See [the Envoy documentation][8] for more information. | 148 | stream-idle-timeout | string | `5m`* | This field defines how long the proxy should wait while there is no activity during single request/response (for HTTP/1.1) or stream (for HTTP/2). Timeout will not trigger while HTTP/1.1 connection is idle between two consecutive requests. Must be a [valid Go duration string][4], or `infinity` to disable the timeout entirely. See [the Envoy documentation][9] for more information. | 149 | max-connection-duration | string | none* | This field defines the maximum period of time after an HTTP connection has been established from the client to the proxy before it is closed by the proxy, regardless of whether there has been activity or not. Must be a [valid Go duration string][4], or omitted or set to `infinity` for no max duration. See [the Envoy documentation][10] for more information. | 150 | delayed-close-timeout | string | `1s`* | *Note: this is an advanced setting that should not normally need to be tuned.* <br /><br /> This field defines how long envoy will wait, once connection close processing has been initiated, for the downstream peer to close the connection before Envoy closes the socket associated with the connection. Setting this timeout to 'infinity' will disable it. See [the Envoy documentation][13] for more information. | 151 | connection-shutdown-grace-period | string | `5s`* | This field defines how long the proxy will wait between sending an initial GOAWAY frame and a second, final GOAWAY frame when terminating an HTTP/2 connection. During this grace period, the proxy will continue to respond to new streams. After the final GOAWAY frame has been sent, the proxy will refuse new streams. Must be a [valid Go duration string][4]. See [the Envoy documentation][11] for more information. | 152 153 _This is Envoy's default setting value and is not explicitly configured by Contour._ 154 155 ### Cluster Configuration 156 157 The cluster configuration block can be used to configure various parameters for Envoy clusters. 158 159 | Field Name | Type | Default | Description | 160 | ----------------- | ------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 161 | dns-lookup-family | string | auto | This field specifies the dns-lookup-family to use for upstream requests to externalName type Kubernetes services from an HTTPProxy route. Values are: `auto`, `v4, `v6` | 162 163 ### Network Configuration 164 165 The network configuration block can be used to configure various parameters network connections. 166 167 | Field Name | Type | Default | Description | 168 | ---------------- | ---- | ------- | ----------------------------------------------------------------------------------------------------------------------- | 169 | num-trusted-hops | int | 0 | Configures the number of additional ingress proxy hops from the right side of the x-forwarded-for HTTP header to trust. | 170 | admin-port | int | 9001 | Configures the Envoy Admin read-only listener on Envoy. Set to `0` to disable. | 171 172 ### Listener Configuration 173 174 The listener configuration block can be used to configure various parameters for Envoy listener. 175 176 | Field Name | Type | Default | Description | 177 | ------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 178 | connection-balancer | string | `""` | This field specifies the listener connection balancer. If the value is `exact`, the listener will use the exact connection balancer to balance connections between threads in a single Envoy process. See [the Envoy documentation][14] for more information. | 179 180 ### Server Configuration 181 182 The server configuration block can be used to configure various settings for the `contour serve` command. 183 184 | Field Name | Type | Default | Description | 185 | --------------- | ------ | ------- | ----------------------------------------------------------------------------- | 186 | xds-server-type | string | contour | This field specifies the xDS Server to use. Options are `contour` or `envoy`. | 187 188 ### Gateway Configuration 189 190 The gateway configuration block is used to configure which gateway-api Gateway Contour should configure: 191 192 | Field Name | Type | Default | Description | 193 | -------------- | ------ | ------- | ------------------------------------------------------------------------------ | 194 | controllerName | string | | Gateway Class controller name (i.e. projectcontour.io/projectcontour/contour). | 195 196 ### Policy Configuration 197 198 The Policy configuration block can be used to configure default policy values 199 that are set if not overridden by the user. 200 201 The `request-headers` field is used to rewrite headers on a HTTP request, and 202 the `response-headers` field is used to rewrite headers on a HTTP response. 203 204 | Field Name | Type | Default | Description | 205 | ---------------- | ------------ | ------- | ------------------------------------------------------------------------------------------------- | 206 | request-headers | HeaderPolicy | none | The default request headers set or removed on all service routes if not overridden in the object | 207 | response-headers | HeaderPolicy | none | The default response headers set or removed on all service routes if not overridden in the object | 208 | applyToIngress | Boolean | false | Whether the global policy should apply to Ingress objects | 209 210 #### HeaderPolicy 211 212 The `set` field sets an HTTP header value, creating it if it doesn't already exist but not overwriting it if it does. 213 The `remove` field removes an HTTP header. 214 215 | Field Name | Type | Default | Description | 216 | ---------- | ----------------- | ------- | ------------------------------------------------------------------------------- | 217 | set | map[string]string | none | Map of headers to set on all service routes if not overridden in the object | 218 | remove | []string | none | List of headers to remove on all service routes if not overridden in the object | 219 220 Note: the values of entries in the `set` and `remove` fields can be overridden in HTTPProxy objects but it it not possible to remove these entries. 221 222 ### Rate Limit Service Configuration 223 224 The rate limit service configuration block is used to configure an optional global rate limit service: 225 226 | Field Name | Type | Default | Description | 227 | ----------------------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 228 | extensionService | string | <none> | This field identifies the extension service defining the rate limit service, formatted as <namespace>/<name>. | 229 | domain | string | contour | This field defines the rate limit domain value to pass to the rate limit service. Acts as a container for a set of rate limit definitions within the RLS. | 230 | failOpen | bool | false | This field defines whether to allow requests to proceed when the rate limit service fails to respond with a valid rate limit decision within the timeout defined on the extension service. | 231 | enableXRateLimitHeaders | bool | false | This field defines whether to include the X-RateLimit headers X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset (as defined by the IETF Internet-Draft https://tools.ietf.org/id/draft-polli-ratelimit-headers-03.html), on responses to clients when the Rate Limit Service is consulted for a request. | 232 233 ### Metrics Configuration 234 235 MetricsParameters holds configurable parameters for Contour and Envoy metrics. 236 237 | Field Name | Type | Default | Description | 238 | ----------- | ----------------------- | ------- | -------------------------------------------------------------------- | 239 | contour | MetricsServerParameters | | [Metrics Server Parameters](#metrics-server-parameters) for Contour. | 240 | envoy | MetricsServerParameters | | [Metrics Server Parameters](#metrics-server-parameters) for Envoy. | 241 242 ### Metrics Server Parameters 243 244 MetricsServerParameters holds configurable parameters for Contour and Envoy metrics. 245 Metrics are served over HTTPS if `server-certificate-path` and `server-key-path` are set. 246 Metrics and health endpoints cannot have the same port number when metrics are served over HTTPS. 247 248 | Field Name | Type | Default | Description | 249 | ----------------------- | ------ | ---------------------------- | -----------------------------------------------------------------------------| 250 | address | string | 0.0.0.0 | Address that metrics server will bind to. | 251 | port | int | 8000 (Contour), 8002 (Envoy) | Port that metrics server will bind to. | 252 | server-certificate-path | string | none | Optional path to the server certificate file. | 253 | server-key-path | string | none | Optional path to the server private key file. | 254 | ca-certificate-path | string | none | Optional path to the CA certificate file used to verify client certificates. | 255 256 ### Configuration Example 257 258 The following is an example ConfigMap with configuration file included: 259 260 ```yaml 261 apiVersion: v1 262 kind: ConfigMap 263 metadata: 264 name: contour 265 namespace: projectcontour 266 data: 267 contour.yaml: | 268 # 269 # server: 270 # determine which XDS Server implementation to utilize in Contour. 271 # xds-server-type: contour 272 # 273 # specify the gateway-api Gateway Contour should configure 274 # gateway: 275 # controllerName: projectcontour.io/projectcontour/contour 276 # 277 # should contour expect to be running inside a k8s cluster 278 # incluster: true 279 # 280 # path to kubeconfig (if not running inside a k8s cluster) 281 # kubeconfig: /path/to/.kube/config 282 # 283 # Disable RFC-compliant behavior to strip "Content-Length" header if 284 # "Tranfer-Encoding: chunked" is also set. 285 # disableAllowChunkedLength: false 286 # Disable HTTPProxy permitInsecure field 287 disablePermitInsecure: false 288 tls: 289 # minimum TLS version that Contour will negotiate 290 # minimum-protocol-version: "1.2" 291 # TLS ciphers to be supported by Envoy TLS listeners when negotiating 292 # TLS 1.2. 293 # cipher-suites: 294 # - '[ECDHE-ECDSA-AES128-GCM-SHA256|ECDHE-ECDSA-CHACHA20-POLY1305]' 295 # - '[ECDHE-RSA-AES128-GCM-SHA256|ECDHE-RSA-CHACHA20-POLY1305]' 296 # - 'ECDHE-ECDSA-AES256-GCM-SHA384' 297 # - 'ECDHE-RSA-AES256-GCM-SHA384' 298 # Defines the Kubernetes name/namespace matching a secret to use 299 # as the fallback certificate when requests which don't match the 300 # SNI defined for a vhost. 301 fallback-certificate: 302 # name: fallback-secret-name 303 # namespace: projectcontour 304 envoy-client-certificate: 305 # name: envoy-client-cert-secret-name 306 # namespace: projectcontour 307 # The following config shows the defaults for the leader election. 308 # leaderelection: 309 # configmap-name: leader-elect 310 # configmap-namespace: projectcontour 311 ### Logging options 312 # Default setting 313 accesslog-format: envoy 314 # The default access log format is defined by Envoy but it can be customized by setting following variable. 315 # accesslog-format-string: "...\n" 316 # To enable JSON logging in Envoy 317 # accesslog-format: json 318 # The default fields that will be logged are specified below. 319 # To customise this list, just add or remove entries. 320 # The canonical list is available at 321 # https://godoc.org/github.com/projectcontour/contour/internal/envoy#JSONFields 322 # json-fields: 323 # - "@timestamp" 324 # - "authority" 325 # - "bytes_received" 326 # - "bytes_sent" 327 # - "downstream_local_address" 328 # - "downstream_remote_address" 329 # - "duration" 330 # - "method" 331 # - "path" 332 # - "protocol" 333 # - "request_id" 334 # - "requested_server_name" 335 # - "response_code" 336 # - "response_flags" 337 # - "uber_trace_id" 338 # - "upstream_cluster" 339 # - "upstream_host" 340 # - "upstream_local_address" 341 # - "upstream_service_time" 342 # - "user_agent" 343 # - "x_forwarded_for" 344 # 345 # default-http-versions: 346 # - "HTTP/2" 347 # - "HTTP/1.1" 348 # 349 # The following shows the default proxy timeout settings. 350 # timeouts: 351 # request-timeout: infinity 352 # connection-idle-timeout: 60s 353 # stream-idle-timeout: 5m 354 # max-connection-duration: infinity 355 # connection-shutdown-grace-period: 5s 356 # 357 # Envoy cluster settings. 358 # cluster: 359 # configure the cluster dns lookup family 360 # valid options are: auto (default), v4, v6 361 # dns-lookup-family: auto 362 # 363 # network: 364 # Configure the number of additional ingress proxy hops from the 365 # right side of the x-forwarded-for HTTP header to trust. 366 # num-trusted-hops: 0 367 # Configure the port used to access the Envoy Admin interface. 368 # admin-port: 9001 369 # 370 # Configure an optional global rate limit service. 371 # rateLimitService: 372 # Identifies the extension service defining the rate limit service, 373 # formatted as <namespace>/<name>. 374 # extensionService: projectcontour/ratelimit 375 # Defines the rate limit domain to pass to the rate limit service. 376 # Acts as a container for a set of rate limit definitions within 377 # the RLS. 378 # domain: contour 379 # Defines whether to allow requests to proceed when the rate limit 380 # service fails to respond with a valid rate limit decision within 381 # the timeout defined on the extension service. 382 # failOpen: false 383 # Defines whether to include the X-RateLimit headers X-RateLimit-Limit, 384 # X-RateLimit-Remaining, and X-RateLimit-Reset (as defined by the IETF 385 # Internet-Draft linked below), on responses to clients when the Rate 386 # Limit Service is consulted for a request. 387 # ref. https://tools.ietf.org/id/draft-polli-ratelimit-headers-03.html 388 # enableXRateLimitHeaders: false 389 # 390 # Global Policy settings. 391 # policy: 392 # # Default headers to set on all requests (unless set/removed on the HTTPProxy object itself) 393 # request-headers: 394 # set: 395 # # example: the hostname of the Envoy instance that proxied the request 396 # X-Envoy-Hostname: %HOSTNAME% 397 # # example: add a l5d-dst-override header to instruct Linkerd what service the request is destined for 398 # l5d-dst-override: %CONTOUR_SERVICE_NAME%.%CONTOUR_NAMESPACE%.svc.cluster.local:%CONTOUR_SERVICE_PORT% 399 # # default headers to set on all responses (unless set/removed on the HTTPProxy object itself) 400 # response-headers: 401 # set: 402 # # example: Envoy flags that provide additional details about the response or connection 403 # X-Envoy-Response-Flags: %RESPONSE_FLAGS% 404 # Whether or not the policy settings should apply to ingress objects 405 # applyToIngress: true 406 # 407 # metrics: 408 # contour: 409 # address: 0.0.0.0 410 # port: 8000 411 # server-certificate-path: /path/to/server-cert.pem 412 # server-key-path: /path/to/server-private-key.pem 413 # ca-certificate-path: /path/to/root-ca-for-client-validation.pem 414 # envoy: 415 # address: 0.0.0.0 416 # port: 8002 417 # server-certificate-path: /path/to/server-cert.pem 418 # server-key-path: /path/to/server-private-key.pem 419 # ca-certificate-path: /path/to/root-ca-for-client-validation.pem 420 ``` 421 422 _Note:_ The default example `contour` includes this [file][1] for easy deployment of Contour. 423 424 ## Environment Variables 425 426 ### CONTOUR_NAMESPACE 427 428 If present, the value of the `CONTOUR_NAMESPACE` environment variable is used as: 429 430 1. The value for the `contour bootstrap --namespace` flag unless otherwise specified. 431 1. The value for the `contour certgen --namespace` flag unless otherwise specified. 432 1. The value for the `contour serve --envoy-service-namespace` flag unless otherwise specified. 433 1. The value for the `leaderelection.configmap-namespace` config file setting for `contour serve` unless otherwise specified. 434 435 The `CONTOUR_NAMESPACE` environment variable is set via the [Downward API][6] in the Contour [example manifests][7]. 436 437 ## Bootstrap Config File 438 439 The bootstrap configuration file is generated by an initContainer in the Envoy daemonset which runs the `contour bootstrap` command to generate the file. 440 This configuration file configures the Envoy container to connect to Contour and receive configuration via xDS. 441 442 The next section outlines all the available flags that can be passed to the `contour bootstrap` command which are used to customize 443 the configuration file to match the environment in which Envoy is deployed. 444 445 ### Flags 446 447 There are flags that can be passed to `contour bootstrap` that help configure how Envoy 448 connects to Contour: 449 450 | Flag | Default | Description | 451 | -------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 452 | <nobr>--resources-dir</nobr> | "" | Directory where resource files will be written. | 453 | <nobr>--admin-address</nobr> | /admin/admin.sock | Path to Envoy admin unix domain socket. | 454 | <nobr>--admin-port (Deprecated)</nobr> | 9001 | Deprecated: Port is now configured as a Contour flag. | 455 | <nobr>--xds-address</nobr> | 127.0.0.1 | Address to connect to Contour xDS server on. | 456 | <nobr>--xds-port</nobr> | 8001 | Port to connect to Contour xDS server on. | 457 | <nobr>--envoy-cafile</nobr> | "" | CA filename for Envoy secure xDS gRPC communication. | 458 | <nobr>--envoy-cert-file</nobr> | "" | Client certificate filename for Envoy secure xDS gRPC communication. | 459 | <nobr>--envoy-key-file</nobr> | "" | Client key filename for Envoy secure xDS gRPC communication. | 460 | <nobr>--namespace</nobr> | projectcontour | Namespace the Envoy container will run, also configured via ENV variable "CONTOUR_NAMESPACE". Namespace is used as part of the metric names on static resources defined in the bootstrap configuration file. | 461 | <nobr>--xds-resource-version</nobr> | v3 | Currently, the only valid xDS API resource version is `v3`. | 462 | <nobr>--dns-lookup-family</nobr> | auto | Defines what DNS Resolution Policy to use for Envoy -> Contour cluster name lookup. Either v4, v6 or auto. | 463 464 465 [1]: {{< param github_url>}}/tree/{{< param branch >}}/examples/contour/01-contour-config.yaml 466 [2]: /guides/structured-logs 467 [3]: https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/ 468 [4]: https://golang.org/pkg/time/#ParseDuration 469 [5]: https://godoc.org/github.com/projectcontour/contour/internal/envoy#DefaultFields 470 [6]: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/ 471 [7]: {{< param github_url>}}/tree/{{< param branch >}}/examples/contour 472 [8]: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-idle-timeout 473 [9]: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto#envoy-v3-api-field-extensions-filters-network-http-connection-manager-v3-httpconnectionmanager-stream-idle-timeout 474 [10]: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-connection-duration 475 [11]: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto#envoy-v3-api-field-extensions-filters-network-http-connection-manager-v3-httpconnectionmanager-drain-timeout 476 [12]: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto#envoy-v3-api-field-extensions-filters-network-http-connection-manager-v3-httpconnectionmanager-request-timeout 477 [13]: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/http_connection_manager/v3/http_connection_manager.proto#envoy-v3-api-field-extensions-filters-network-http-connection-manager-v3-httpconnectionmanager-delayed-close-timeout 478 [14]: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/listener/v3/listener.proto#config-listener-v3-listener-connectionbalanceconfig