You are browsing documentation for an older version. See the latest documentation here.
Fault Injection
New to Kuma? You need this policy, check
MeshFaultInjection
instead.
Fault Injection is an inbound policy. Dataplanes whose configuration is modified are in the
destinations
matcher.
FaultInjection
policy helps you to test your microservices against resiliency. Kong Mesh provides 3 different types of failures that could be imitated in your environment.
These faults are Delay, Abort and ResponseBandwidth limit.
Usage
apiVersion: kuma.io/v1alpha1
kind: FaultInjection
mesh: default
metadata:
name: fi1
spec:
sources:
- match:
kuma.io/service: frontend_default_svc_80
version: "0.1"
kuma.io/protocol: http
destinations:
- match:
kuma.io/service: backend_default_svc_80
kuma.io/protocol: http
conf:
abort:
httpStatus: 500
percentage: 50
delay:
percentage: 50.5
value: 5s
responseBandwidth:
limit: 50 mbps
percentage: 50
Sources & Destinations
FaultInjection
is a policy, which is applied to the connection between dataplanes. As most of the policies, FaultInjection
supports the powerful mechanism of matching, which allows you to precisely match source and destination dataplanes.
FaultInjection
policy is available only for L7 HTTP traffic, thereforekuma.io/protocol
is a mandatory tag for the destination selector and must be of valuehttp
,http2
orgrpc
.
HTTP Faults
At least one of the following Faults should be specified.
Abort
Abort defines a configuration of not delivering requests to destination service and replacing the responses from destination dataplane by predefined status code.
-
httpStatus
- HTTP status code which will be returned to source side -
percentage
- percentage of requests on which abort will be injected, has to be in [0.0 - 100.0] range
Delay
Delay defines configuration of delaying a response from a destination.
-
value
- the duration during which the response will be delayed -
percentage
- percentage of requests on which delay will be injected, has to be in [0.0 - 100.0] range
ResponseBandwidth limit
ResponseBandwidth defines a configuration to limit the speed of responding to the requests.
-
limit
- represented by value measure in gbps, mbps, kbps or bps, e.g. 10kbps -
percentage
- percentage of requests on which response bandwidth limit will be injected, has to be in [0.0 - 100.0] range
Matching
FaultInjection
is an Inbound Connection Policy.
You can use all the tags in both sources
and destinations
sections.
All options
$schema: http://json-schema.org/draft-04/schema#
$ref: #/definitions/FaultInjection
definitions
FaultInjection
## Fault Injection
FaultInjection defines the configuration of faults between dataplanes.
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
- Configuration of FaultInjection
- Type:
object
- $ref: #/definitions/kuma.mesh.v1alpha1.FaultInjection.Conf
- This schema accepts additional properties.
- Properties kuma.mesh.v1alpha1.FaultInjection.Conf
- sources
## Conf
Conf defines several types of faults, at least one fault should be specified
Type:
object
This schema accepts additional properties.
Properties
- delay
- Delay if specified then response from the destination will be delivered with a delay
- Type:
object
- $ref: #/definitions/kuma.mesh.v1alpha1.FaultInjection.Conf.Delay
- This schema accepts additional properties.
- Properties
- abort
- Abort if specified makes source side to receive specified httpStatus code
- Type:
object
- $ref: #/definitions/kuma.mesh.v1alpha1.FaultInjection.Conf.Abort
- This schema accepts additional properties.
- Properties
- response_bandwidth
- ResponseBandwidth if specified limits the speed of sending response body
- Type:
object
- $ref: #/definitions/kuma.mesh.v1alpha1.FaultInjection.Conf.ResponseBandwidth
- This schema accepts additional properties.
- Properties kuma.mesh.v1alpha1.FaultInjection.Conf.Abort
- delay
## Abort
Abort defines a configuration of not delivering requests to destination service and replacing the responses from destination dataplane by predefined status code
Type:
object
This schema accepts additional properties.
Properties
- percentage
- Percentage of requests on which abort will be injected, has to be in [0.0 - 100.0] range
- Type:
number
- httpStatus
- HTTP status code which will be returned to source side
- Type:
integer
kuma.mesh.v1alpha1.FaultInjection.Conf.Delay
- percentage
## Delay
Delay defines configuration of delaying a response from a destination
Type:
object
This schema accepts additional properties.
Properties
- percentage
- Percentage of requests on which delay will be injected, has to be in [0.0 - 100.0] range
- Type:
number
- value
- The duration during which the response will be delayed
- Type:
string
- String format must be a "regex"
- The value must match this pattern:
^([0-9]+\.?[0-9]*|\.[0-9]+)s$
kuma.mesh.v1alpha1.FaultInjection.Conf.ResponseBandwidth
- percentage
## Response Bandwidth
ResponseBandwidth defines a configuration to limit the speed of responding to the requests
Type:
object
This schema accepts additional properties.
Properties
- percentage
- Percentage of requests on which response bandwidth limit will be injected, has to be in [0.0 - 100.0] range
- Type:
number
- limit
- Limit is represented by value measure in gbps, mbps, kbps or bps, e.g. 10kbps
- Type:
string
kuma.mesh.v1alpha1.Selector
- percentage
## 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
Generated with json-schema-md-doc Tue Apr 08 2025 19:39:35 GMT+0000 (Coordinated Universal Time)