VMware HTTP reset peer
VMware HTTP reset peer injects HTTP reset chaos that stops the outgoing HTTP requests by resetting the TCP connection for the requests.
- The service whose port is affected is specified using the
TARGET_SERVICE_PORT
environment variable. - It tests the application's resilience to lossy (or flaky) HTTP connections.
Usage
View the uses of the fault
Prerequisites
- Kubernetes >= 1.17
- Vcenter access to stop and start the VM.
- Kubernetes secret that has the Vcenter credentials in the
CHAOS_NAMESPACE
. Below is a sample secret file:
apiVersion: v1
kind: Secret
metadata:
name: vcenter-secret
namespace: litmus
type: Opaque
stringData:
VCENTERSERVER: XXXXXXXXXXX
VCENTERUSER: XXXXXXXXXXXXX
VCENTERPASS: XXXXXXXXXXXXX
Note
You can pass the VM credentials as secrets or as a ChaosEngine
environment variable.
Default validations
The VM should be in a healthy state.
Fault tunables
Fault tunables
Mandatory fields
Variables | Description | Notes |
---|---|---|
VM_NAME | Name of the VMware VM. | For example, test-vm . |
VM_USER_NAME | Username with sudo privileges. | For example, vm-user . |
VM_PASSWORD | User password. | For example, 1234 . |
RESET_TIMEOUT | It specifies the duration after which the connect is reset. | Defaults to 0. |
TARGET_SERVICE_PORT | Service port to target | Defaults to port 80. |
Optional Fields
Variables | Description | Notes |
---|---|---|
TOTAL_CHAOS_DURATION | Duration that you specify, through which chaos is injected into the target resource (in seconds). | Defaults to 30s. |
CHAOS_INTERVAL | Time interval between two successive instance terminations (in seconds). | Defaults to 30s. |
SEQUENCE | Sequence of chaos execution for multiple instances. | Defaults to parallel. Supports serial sequence as well. |
RAMP_TIME | Period to wait before and after injecting chaos (in seconds). | For example, 30s. |
INSTALL_DEPENDENCY | Specify whether you wish to install the dependency to run the experiment. | Defaults to true. If the dependency already exists, you can turn it off. |
PROXY_PORT | Port where the proxy listens for requests. | Defaults to 20000. |
TOXICITY | Percentage of HTTP requests that are affected. | Defaults to 100. |
NETWORK_INTERFACE | Network interface used for the proxy. | Defaults to eth0. |
Fault examples
Common fault tunables
Refer to the common attributes to tune the common tunables for all the faults.
Target service port
It defines the port of the target service. You can tune it using the TARGET_SERVICE_PORT
environment variable.
Use the following example to tune it:
## provide the port of the targeted service
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-http-reset-peer
spec:
components:
env:
# provide the port of the targeted service
- name: TARGET_SERVICE_PORT
value: "80"
Proxy port
It defines the port where proxy server listens for requests. You can tune it using the PROXY_PORT
environment variable.
Use the following example to tune it:
# provide the port for proxy server
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-http-reset-peer
spec:
components:
env:
# provide the port for proxy server
- name: PROXY_PORT
value: '8080'
# provide the port of the targeted service
- name: TARGET_SERVICE_PORT
value: "80"
Reset timeout
It defines the reset timeout value that is added to the HTTP request. You can tune it using the RESET_TIMEOUT
environment variable.
Use the following example to tune it:
## provide the reset timeout value
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-http-reset-peer
spec:
components:
env:
# reset timeout specifies after how much duration to reset the connection
- name: RESET_TIMEOUT #in ms
value: '2000'
# provide the port of the targeted service
- name: TARGET_SERVICE_PORT
value: "80"
Toxicity
It defines the toxicity value, i.e the percentage of the total number of HTTP requests that are affected. You can tune it using the TOXICITY
environment variable.
Use the following example to tune it:
## provide the toxicity
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-http-reset-peer
spec:
components:
env:
# toxicity is the probability of the request to be affected
# provide the percentage value in the range of 0-100
# 0 means no request will be affected and 100 means all request will be affected
- name: TOXICITY
value: "100"
# provide the port of the targeted service
- name: TARGET_SERVICE_PORT
value: "80"
Network interface
It defines the network interface that is used for the proxy. You can tune it using the NETWORK_INTERFACE
environment variable.
Use the following example to tune it:
## provide the network interface for proxy
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-http-reset-peer
spec:
components:
env:
# provide the network interface for proxy
- name: NETWORK_INTERFACE
value: "eth0"
# provide the port of the targeted service
- name: TARGET_SERVICE_PORT
value: '80'