This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Node Network Chaos

Injects network degradation (latency, packet loss, bandwidth) into a target node’s network interfaces using Linux tc rules.

    Injects network degradation (latency, packet loss, bandwidth restriction) into a target node’s network interfaces using Linux tc (traffic control) rules. Unlike node-network-filter which blocks specific ports via iptables, this module shapes traffic at the interface level. Includes safety checks for existing tc rules on the node.

    How to Run Node Network Chaos Scenarios

    Choose your preferred method to run node network chaos scenarios:

    Configuration

    - id: node_network_chaos
      image: "quay.io/krkn-chaos/krkn-network-chaos:latest"
      wait_duration: 1
      test_duration: 60
      label_selector: ""
      service_account: ""
      instance_count: 1
      execution: parallel
      namespace: default
      # scenario specific settings
      target: "<node_name>"
      interfaces: []
      ingress: true
      egress: true
      latency: ""         # empty string to skip; or e.g. 100ms (units: us, ms, s)
      loss: 10           # percentage (no % symbol)
      bandwidth: 1gbit   # supported units: bit, kbit, mbit, gbit, tbit
      force: false
      taints: []
    

    For the common module settings please refer to the documentation.

    • latency: network latency to inject. Format: integer followed by us (microseconds), ms (milliseconds), or s (seconds). Example: 100ms. Set to empty string to skip.
    • loss: packet loss percentage as a plain integer (no % symbol). Example: 10 means 10% packet loss. Set to empty string to skip.
    • bandwidth: bandwidth limit. Format: integer followed by bit, kbit, mbit, gbit, or tbit. Example: 100mbit. Set to empty string to skip.
    • interfaces: list of network interface names to target. Leave empty to auto-detect the node’s default interface.
    • ingress: apply rules to incoming traffic (default: true)
    • egress: apply rules to outgoing traffic (default: true)
    • target: the node name to target (used when label_selector is not set)
    • force: by default (false), if the target node already has tc rules configured, the scenario aborts with a warning to avoid damaging cluster networking. Set to true to override existing rules. A 10-second warning delay is inserted before proceeding. Use with caution.

    Usage

    To enable node network chaos scenarios edit the kraken config file, go to the section kraken -> chaos_scenarios of the yaml structure and add a new element to the list named network_chaos_ng_scenarios then add the desired scenario pointing to the scenario yaml file.

    kraken:
        ...
        chaos_scenarios:
            - network_chaos_ng_scenarios:
                - scenarios/kube/node-network-chaos.yml
    

    Run

    python run_kraken.py --config config/config.yaml
    

    Example scenario file: node-network-chaos.yml