How xk6-disruptor works
xk6-disruptor consists of two main components:
- The xk6-disruptor-agent injects faults into the target system where it runs. It is provided as an Docker image that you can pull from the xk6-disruptor repository.
The xk6-disruptor extension installs the agent in the target and sends commands to inject the desired faults. How this happens depends on the type of disruptor, as described in the following sections.
The following diagram shows how PodDisruptor works:
- The PodDisruptor selects the target pods based on the selector attributes defined in the constructor
- The PodDisruptor attaches the xk6-disruptor-agent to each of the target pods
- When a fault is injected (e.g. calling the injectHTTTFault) the PodDisruptor sends a command to the agents to inject the fault in their respective pods
The ServiceDisruptor works as a wrapper around a PodDisruptor, which targets the pods that back the service.
- The ServiceDisruptor uses the definition of the service specified in the constructor to create a pod selector that matches the pods that back the service.
- The ServiceDisruptor creates a PodDisruptor using this pod selector.
- The PodDisruptor installs the agent in the target pods.
From this point, the PodDisruptor works as described before.