Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/chaos-mesh/chaos-mesh/llms.txt

Use this file to discover all available pages before exploring further.

HTTPChaos allows you to inject faults into HTTP requests and responses, including delays, aborts, replacing request/response content, and more.

API Version and Kind

apiVersion: chaos-mesh.org/v1alpha1
kind: HTTPChaos

Metadata

Standard Kubernetes object metadata.
metadata.name
string
required
Name of the HTTPChaos resource.
metadata.namespace
string
Namespace of the HTTPChaos resource. Defaults to default.

Spec Fields

spec
HTTPChaosSpec
required
Defines the behavior of the HTTP chaos experiment.

HTTPChaosSpec

selector
PodSelector
required
Selector for targeting pods. See PodSelector in Common Types.Inherits all fields from PodSelector (inline), including:
  • Pod selection criteria
  • Mode (one/all/fixed/fixed-percent/random-max-percent)
  • Value (for fixed modes)
target
PodHttpChaosTarget
required
Object to be selected and injected.Enum values:
  • Request - Target HTTP requests
  • Response - Target HTTP responses
port
int32
required
Target port to proxy.
port: 8080
path
*string
Rule to select target by URI path in HTTP request.
path: "/api/v1/*"
method
*string
Rule to select target by HTTP method in request.
method: "GET"
code
*int32
Rule to select target by HTTP status code in response.
code: 200
request_headers
map[string]string
Rule to select target by HTTP headers in request. Key-value pairs represent header name and value.
request_headers:
  Content-Type: "application/json"
  Authorization: "Bearer *"
response_headers
map[string]string
Rule to select target by HTTP headers in response. Key-value pairs represent header name and value.
response_headers:
  Content-Type: "application/json"
abort
bool
Abort the HTTP request/response. Part of PodHttpChaosActions (inline).
delay
string
Delay duration for the HTTP request/response. Part of PodHttpChaosActions (inline).
delay: "10s"
replace
PodHttpChaosReplaceActions
Replace actions for HTTP request/response. Part of PodHttpChaosActions (inline).
patch
PodHttpChaosPatchActions
Patch actions for HTTP request/response. Part of PodHttpChaosActions (inline).
tls
*PodHttpChaosTLS
TLS configuration. Will override PodHttpChaos if multiple HTTPChaos experiments are applied.
duration
*string
Duration of the chaos action.A duration string with format like "300ms", "1.5h", or "2h45m".Valid time units: ns, us (µs), ms, s, m, h
remoteCluster
string
Name of the remote cluster where the chaos will be deployed. If not specified, chaos is applied to the local cluster.

Status Fields

status
HTTPChaosStatus
Current status of the chaos experiment.

HTTPChaosStatus

conditions
[]ChaosCondition
Current global conditions. See ChaosStatus in Common Types.
experiment
ExperimentStatus
Last known experiment state including desired phase and container records.
instances
map[string]int64
Always specifies PodHttpChaos generation or empty.

Example

apiVersion: chaos-mesh.org/v1alpha1
kind: HTTPChaos
metadata:
  name: http-delay
  namespace: chaos-mesh
spec:
  mode: all
  selector:
    namespaces:
      - default
    labelSelectors:
      app: web
  target: Request
  port: 8080
  method: "GET"
  path: "/api/*"
  delay: "10s"
  duration: "5m"