github.com/projectcontour/contour@v1.28.2/site/content/docs/v1.12.0/configuration.md (about) 1 # Contour Configuration Reference 2 3 - [Configuration File](#configuration-file) 4 - [Environment Variables](#environment-variables) 5 - [Bootstrap Config File](#bootstrap-config-file) 6 7 ## Configuration File 8 9 A configuration file can be passed to the `--config-path` argument of the `contour serve` command to specify additional configuration to Contour. 10 In most deployments, this file is passed to Contour via a ConfigMap which is mounted as a volume to the Contour pod. 11 12 The Contour configuration file is optional. 13 In its absence, Contour will operate with reasonable defaults. 14 Where Contour settings can also be specified with command-line flags, the command-line value takes precedence over the configuration file. 15 16 | Field Name | Type | Default | Description | 17 |------------|------|---------|-------------| 18 | accesslog-format | string | `envoy` | This key sets the global [access log format][2] for Envoy. Valid options are `envoy` or `json`. | 19 | debug | boolean | `false` | Enables debug logging. | 20 | 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. | 21 | 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. | 22 | disablePermitInsecure | boolean | `false` | If this field is true, Contour will ignore `PermitInsecure` field in HTTPProxy documents. | 23 | envoy-service-name | string | `envoy` | This sets the service name that will be inspected for address details to be applied to Ingress objects. | 24 | 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. | 25 | 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`.| 26 | incluster | boolean | `false` | This field specifies that Contour is running in a Kubernetes cluster and should use the in-cluster client access configuration. | 27 | json-fields | string array | [fields][5]| This is the list the field names to include in the JSON [access log format][2]. | 28 | kubeconfig | string | `$HOME/.kube/config` | Path to a Kubernetes [kubeconfig file][3] for when Contour is executed outside a cluster. | 29 | leaderelection | leaderelection | | The [leader election configuration](#leader-election-configuration). | 30 | tls | TLS | | The default [TLS configuration](#tls-configuration). | 31 | timeouts | TimeoutConfig | | The [timeout configuration](#timeout-configuration). | 32 | cluster | ClusterConfig | | The [cluster configuration](#cluster-configuration). | 33 | server | ServerConfig | | The [server configuration](#server-configuration) for `contour serve` command. | 34 35 36 ### TLS Configuration 37 38 The TLS configuration block can be used to configure default values for how 39 Contour should provision TLS hosts. 40 41 | Field Name | Type| Default | Description | 42 |------------|-----|----------|-------------| 43 | 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. | 44 | fallback-certificate | | | [Fallback certificate configuration](#fallback-certificate). | 45 | envoy-client-certificate | | | [Client certificate configuration for Envoy](#envoy-client-certificate). | 46 47 48 ### Fallback Certificate 49 50 | Field Name | Type| Default | Description | 51 |------------|-----|----------|-------------| 52 | name | string | `""` | This field specifies the name of the Kubernetes secret to use as the fallback certificate. | 53 | namespace | string | `""` | This field specifies the namespace of the Kubernetes secret to use as the fallback certificate. | 54 55 56 ### Envoy Client Certificate 57 58 | Field Name | Type| Default | Description | 59 |------------|-----|----------|-------------| 60 | 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. | 61 | 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. | 62 63 64 ### Leader Election Configuration 65 66 The leader election configuration block configures how a deployment with more than one Contour pod elects a leader. 67 The Contour leader is responsible for updating the status field on Ingress and HTTPProxy documents. 68 In the vast majority of deployments, only the `configmap-name` and `configmap-namespace` fields should require any configuration. 69 70 | Field Name | Type | Default | Description | 71 |------------|------|---------|-------------| 72 | configmap-name | string | `leader-elect` | The name of the ConfigMap that Contour leader election will lease. | 73 | 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. | 74 | lease-duration | [duration][4] | `15s` | The duration of the leadership lease. | 75 | renew-deadline | [duration][4] | `10s` | The length of time that the leader will retry refreshing leadership before giving up. | 76 | retry-period | [duration][4] | `2s` | The interval at which Contour will attempt to the acquire leadership lease. | 77 78 79 ### Timeout Configuration 80 81 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. 82 83 | Field Name | Type| Default | Description | 84 |------------|-----|----------|-------------| 85 | 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._ | 86 | 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. Must be a [valid Go duration string][4], or `infinity` to disable the timeout entirely. See [the Envoy documentation][8] for more information. | 87 | stream-idle-timeout| string | `5m`* |This field defines how long the proxy should wait while there is no request activity (for HTTP/1.1) or stream activity (for HTTP/2) before terminating the HTTP request or stream. Must be a [valid Go duration string][4], or `infinity` to disable the timeout entirely. See [the Envoy documentation][9] for more information. | 88 | 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. | 89 | 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. | 90 91 _* This is Envoy's default setting value and is not explicitly configured by Contour._ 92 93 ### Cluster Configuration 94 95 The cluster configuration block can be used to configure various parameters for Envoy clusters. 96 97 | Field Name | Type| Default | Description | 98 |------------|-----|----------|-------------| 99 | 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` | 100 101 102 ### Server Configuration 103 104 The server configuration block can be used to configure various settings for the `contour serve` command. 105 106 | Field Name | Type| Default | Description | 107 |------------|-----|----------|-------------| 108 | xds-server-type | string | contour | This field specifies the xDS Server to use. Options are `contour` or `envoy`. | 109 110 111 ### Configuration Example 112 113 The following is an example ConfigMap with configuration file included: 114 115 ```yaml 116 apiVersion: v1 117 kind: ConfigMap 118 metadata: 119 name: contour 120 namespace: projectcontour 121 data: 122 contour.yaml: | 123 # server: 124 # determine which XDS Server implementation to utilize in Contour. 125 # xds-server-type: contour 126 # 127 # should contour expect to be running inside a k8s cluster 128 # incluster: true 129 # 130 # path to kubeconfig (if not running inside a k8s cluster) 131 # kubeconfig: /path/to/.kube/config 132 # 133 # disable httpproxy permitInsecure field 134 # disablePermitInsecure: false 135 tls: 136 # minimum TLS version that Contour will negotiate 137 # minimumProtocolVersion: "1.2" 138 fallback-certificate: 139 # name: fallback-secret-name 140 # namespace: projectcontour 141 envoy-client-certificate: 142 # name: envoy-client-cert-secret-name 143 # namespace: projectcontour 144 # The following config shows the defaults for the leader election. 145 # leaderelection: 146 # configmap-name: leader-elect 147 # configmap-namespace: projectcontour 148 # Default HTTP versions. 149 # default-http-versions: 150 # - "HTTP/1.1" 151 # - "HTTP/2" 152 # The following shows the default proxy timeout settings. 153 # timeouts: 154 # request-timeout: infinity 155 # connection-idle-timeout: 60s 156 # stream-idle-timeout: 5m 157 # max-connection-duration: infinity 158 # connection-shutdown-grace-period: 5s 159 # 160 # Envoy cluster settings. 161 # cluster: 162 # configure the cluster dns lookup family 163 # valid options are: auto (default), v4, v6 164 # dns-lookup-family: auto 165 ``` 166 167 _Note:_ The default example `contour` includes this [file][1] for easy deployment of Contour. 168 169 ## Environment Variables 170 171 ### CONTOUR_NAMESPACE 172 173 If present, the value of the `CONTOUR_NAMESPACE` environment variable is used as: 174 175 1. The value for the `contour bootstrap --namespace` flag unless otherwise specified. 176 1. The value for the `contour certgen --namespace` flag unless otherwise specified. 177 1. The value for the `contour serve --envoy-service-namespace` flag unless otherwise specified. 178 1. The value for the `leaderelection.configmap-namespace` config file setting for `contour serve` unless otherwise specified. 179 180 The `CONTOUR_NAMESPACE` environment variable is set via the [Downward API][6] in the Contour [example manifests][7]. 181 182 ## Bootstrap Config File 183 184 The bootstrap configuration file is generated by an initContainer in the Envoy daemonset which runs the `contour bootstrap` command to generate the file. 185 This configuration file configures the Envoy container to connect to Contour and receive configuration via xDS. 186 187 The next section outlines all the available flags that can be passed to the `contour bootstrap` command which are used to customize 188 the configuration file to match the environment in which Envoy is deployed. 189 190 ### Flags 191 192 There are flags that can be passed to `contour bootstrap` that help configure how Envoy 193 connects to Contour: 194 195 | Flag | Default | Description | 196 |------------|----------|-------------| 197 | <nobr>--resources-dir</nobr> | "" | Directory where resource files will be written. | 198 | <nobr>--admin-address</nobr> | 127.0.0.1 | Address the Envoy admin webpage will listen on. | 199 | <nobr>--admin-port</nobr> | 9001 | Port the Envoy admin webpage will listen on. | 200 | <nobr>--xds-address</nobr> | 127.0.0.1 | Address to connect to Contour xDS server on. | 201 | <nobr>--xds-port</nobr> | 8001 | Port to connect to Contour xDS server on. | 202 | <nobr>--envoy-cafile</nobr> | "" | CA filename for Envoy secure xDS gRPC communication. | 203 | <nobr>--envoy-cert-file</nobr> | "" | Client certificate filename for Envoy secure xDS gRPC communication. | 204 | <nobr>--envoy-key-file</nobr> | "" | Client key filename for Envoy secure xDS gRPC communication. | 205 | <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. | 206 | <nobr>--xds-resource-version</nobr> | v3 | Currently, the only valid xDS API resource version is `v3`. | 207 208 209 210 [1]: {{< param github_url >}}/tree/{{< param version >}}/examples/contour/01-contour-config.yaml 211 [2]: /guides/structured-logs 212 [3]: https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/ 213 [4]: https://golang.org/pkg/time/#ParseDuration 214 [5]: https://godoc.org/github.com/projectcontour/contour/internal/envoy#DefaultFields 215 [6]: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/ 216 [7]: {{< param github_url >}}/tree/{{< param version >}}/examples/contour 217 [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 218 [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 219 [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 220 [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 221 [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