You are browsing documentation for an older version. See the latest documentation here.
Timeout
New to Kuma? Don’t use this policy, check
MeshTimeout
instead. If you want to use theRetry
policy, remember that it requires the TrafficRoute policy to function properly.
Timeout is an outbound policy. Dataplanes whose configuration is modified are in the
sources
matcher.
This policy enables Kong Mesh to set timeouts on the outbound connections depending on the protocol.
Usage
Specify the proxy to configure with the sources
selector, and the outbound connections from the proxy with the destinations
selector.
The policy lets you configure timeouts for HTTP
, GRPC
, and TCP
protocols.
More about Protocol support in Kong Mesh.
Configuration
Timeouts applied when communicating with services of any protocol:
Field: connectTimeout
Description: time to establish a connection
Default value: 10s
Envoy conf: Cluster
Timeouts applied when communicating with TCP services:
Field: tcp.idleTimeout
Description: period in which there are no bytes sent or received
on either the upstream or downstream connection
Default value: disabled
Envoy conf: TCPProxy
Timeouts applied when communicating with HTTP, HTTP2 or GRPC services:
Field: http.requestTimeout
Description: is a span between the point at which the entire
downstream request (i.e. end-of-stream) has been processed and when the
upstream response has been completely processed
Default value: disabled
Envoy conf: Route
Field: http.idleTimeout
Description: time at which a downstream or upstream connection
will be terminated if there are no active streams
Default value: disabled
Envoy conf: HTTPConnectionManager and Cluster
Field: http.streamIdleTimeout
Description: amount of time that the connection manager
will allow a stream to exist with no upstream or downstream activity
Default value: disabled
Envoy conf: HTTPConnectionManager
Field: http.maxStreamDuration
Description: maximum time that a stream’s lifetime will span
Default value: disabled
Envoy conf: Cluster
Default general-purpose Timeout policy
By default, Kong Mesh creates the following Timeout policy:
Default timeout policy works fine in most cases. But if your application is using GRPC streaming make sure to set
http.requestTimeout
to 0s.
Matching
Timeout
is an Outbound Connection Policy.
The only supported value for destinations.match
is kuma.io/service
.
Builtin Gateway support
Timeouts are connection policies and are supported by configuring the timeout parameters on the target Envoy cluster. Request timeouts are configured on the Envoy routes and may select a different Timeout policy when a route backend forwards to more than one distinct service.
Mesh configures an idle timeout on the HTTPConnectionManager, but doesn’t consistently use the Timeout policy values for this, so the semantica are ambiguous. There’s no policy that configures the idle timeout for downstream connections to the Gateway.
Inbound timeouts
Currently, there is no policy to set inbound timeouts. Timeouts on the inbound side have constant values:
connectTimeout: 10s
tcp:
idleTimeout: 2h
http:
requestTimeout: 0s
idleTimeout: 2h
streamIdleTimeout: 1h
maxStreamDuration: 0s
If you still need to change inbound timeouts you can use a ProxyTemplate:
It’s not recommended disabling
streamIdleTimeouts
andidleTimeout
since it has a high likelihood of yielding connection leaks.
Non-mesh traffic
When passthrough mode is activated any non-mesh traffic is passing Envoy without applying the Timeout policies. Read more about Non-mesh traffic.
All options
$schema: http://json-schema.org/draft-04/schema#
$ref: #/definitions/Timeout
definitions
Timeout
- ## Timeout
- Type:
object
- This schema accepts additional properties.
- Properties
- sources
- List of selectors to match dataplanes that are sources of traffic.
- Type:
array
- Items
- $ref: #/definitions/kuma.mesh.v1alpha1.Selector
- destinations
- List of selectors to match services that are destinations of traffic.
- Type:
array
- Items
- $ref: #/definitions/kuma.mesh.v1alpha1.Selector
- conf
- sources
kuma.mesh.v1alpha1.Selector
- ## Selector
- Selector defines structure for selecting tags for given dataplane
- Type:
object
- This schema accepts additional properties.
- Properties
- match
- Tags to match, can be used for both source and destinations
- Type:
object
- This schema accepts additional properties.
- Properties
- match
kuma.mesh.v1alpha1.Timeout.Conf
- ## Conf
- Type:
object
- This schema accepts additional properties.
- Properties
- connect_timeout
- ConnectTimeout defines time to establish connection
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
- tcp
- http
- grpc
- Deprecated: set parameters through Http section
- $ref: #/definitions/kuma.mesh.v1alpha1.Timeout.Conf.Grpc
- connect_timeout
kuma.mesh.v1alpha1.Timeout.Conf.Grpc
- ## Grpc
- Grpc defines timeouts that are applied when the protocol is GRPC
- Type:
object
- This schema accepts additional properties.
- Properties
- streamidletimeout
- StreamIdleTimeout is the amount of time that the connection manager will allow a stream to exist with no upstream or downstream activity Deprecated: use Http.StreamIdleTimeout instead
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
- maxstreamduration
- MaxStreamDuration is the maximum time that a stream’s lifetime will span Deprecated: use Http.MaxStreamDuration instead
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
- streamidletimeout
kuma.mesh.v1alpha1.Timeout.Conf.Http
- ## Http
- Http defines timeouts that are applied when the protocol is HTTP
- Type:
object
- This schema accepts additional properties.
- Properties
- request_timeout
- RequestTimeout is a span between the point at which the entire downstream request (i.e. end-of-stream) has been processed and when the upstream response has been completely processed
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
- idle_timeout
- IdleTimeout is the time at which a downstream or upstream connection will be terminated if there are no active streams
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
- streamidletimeout
- StreamIdleTimeout is the amount of time that the connection manager will allow a stream to exist with no upstream or downstream activity
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
- maxstreamduration
- MaxStreamDuration is the maximum time that a stream’s lifetime will span
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
- request_timeout
kuma.mesh.v1alpha1.Timeout.Conf.Tcp
- ## Tcp
- Tcp defines timeouts that are applied when the protocol is TCP
- Type:
object
- This schema accepts additional properties.
- Properties
- idle_timeout
- IdleTimeout is defined as the period in which there are no bytes sent or received on either the upstream or downstream connection
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
- idle_timeout
Generated with json-schema-md-doc