Pod IO attribute override
Pod IO Attribute Override, modify the properties of files located within the mounted volume of the pod. This fault should be used as a sanity test for validating your application's failover capability against unexpected changes in file attributes, such as permissions, ownership, or timestamps.
Use cases
Pod IO attribute override:
- Tests whether your application is able to detect and respond to unexpected changes in file attributes, which can help you ensure that your system remains compliant and secure.
- Tests whether your disaster recovery system is able to restore files and maintain file attributes correctly.
- Tests whether your backup system is able to restore files and maintain file attributes correctly.
- Tests whether your change management process is able to detect and respond to unexpected changes in file attributes, which can help you ensure that your system remains stable and secure.
- Due to the large blast radius of this fault, we recommend you do not execute it in the production environment.
- Through the fault execution, the application pod can potentially fail to perform successful IO writes if the
write
system call is being targeted. This can cause any data produced in this duration to be lost. - Any data produced before the execution of the fault is not harmed as a result of its execution.
- Kubernetes 1.16 is required to execute this fault.
- The application pods should be in the running state before and after injecting chaos.
Fault tunables
Mandatory tunables
Tunable | Description | Notes |
---|---|---|
ATTRIBUTES | Specify the file attributes and their values that need to be overridden | For more information, go to attributes. |
MOUNT_PATH | The absolute mount path of the volume mounted to the target pod | For more information, go to mount path. |
Optional tunables
Tunable | Description | Notes |
---|---|---|
TARGET_CONTAINER | Name of the container subject to IO attribute override | If the value is not provided, the fault injects chaos on the first container of the pod. For more information, go to target specific container. |
FILE_PATH | The path for injecting faults can be specified as either a single file or a wildcard. If not provided, it will target all the files present inside the mount path | For more information, go to file path. |
PERCENTAGE | The likelihood of failure per operation, expressed as a percentage | For more information, go to percentage. |
METHOD_TYPES | This contains the file system call or methods | For more information, go to percentage. |
CONTAINER_RUNTIME | Container runtime interface for the cluster | Default: containerd. Supports docker, containerd and crio. For more information, go to container runtime . |
SOCKET_PATH | Path of the containerd or crio or docker socket file | Defaults to /run/containerd/containerd.sock . For more information, go to socket path. |
TOTAL_CHAOS_DURATION | Duration to inject insert chaos (in seconds) | Default: 60 s. For more information, go to duration of the chaos. |
TARGET_PODS | Comma-separated list of application pod names subject to pod io attribute override | If not provided, the fault selects target pods randomly based on provided appLabels. For more information, go to target specific pods. |
PODS_AFFECTED_PERC | Percentage of total pods to target. Provide numeric values | Default: 0 (corresponds to 1 replica). For more information, go to pod affected percentage. |
RAMP_TIME | Period to wait before and after injecting chaos (in seconds) | For example, 30 s. For more information, go to ramp time. |
SEQUENCE | Sequence of chaos execution for multiple target pods | Default: parallel. Supports serial and parallel. For more information, go to sequence of chaos execution. |
Attributes
Modify the properties of files located within the mounted volume of the pod. Tune it by using the ATTRIBUTES
environment variable.
The following YAML snippet illustrates the use of this environment variable:
# it overrides the file attributes
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-io-attribute-override
spec:
components:
env:
# file attributes
- name: ATTRIBUTES
value: '{"perm": 72}'
- name: MOUNT_PATH
value: '/etc/config'
- name: TOTAL_CHAOS_DURATION
value: '60'
Mount Path
Mount path of the volume mounted to the target application. Tune it by using the MOUNT_PATH
environment variable.
The following YAML snippet illustrates the use of this environment variable:
# it overrides the file attributes
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-io-attribute-override
spec:
components:
env:
# mount path of the volume
- name: MOUNT_PATH
value: '/etc/config'
- name: ATTRIBUTES
value: '{"perm": 72}'
- name: TOTAL_CHAOS_DURATION
value: '60'
Advanced Fault Tunables
FILE_PATH
: The path for injecting faults can be specified as either a single file or a wildcard. By default it targets all the files present inside the mount path.PERCENTAGE
: The likelihood of failure per operation, expressed as a percentage. Default is 100%.METHOD_TYPES
: This contains the file system call or methods. By default it targets all the methods.
The following YAML snippet illustrates the use of this environment variable:
# it overrides the file attributes
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-io-attribute-override
spec:
components:
env:
# filter the target files
- name: FILE_PATH
value: '/etc/config/file.txt'
# percentage of i/o calls
- name: PERCENTAGE
value: '50'
# names of the io methods
- name: METHOD_TYPES
value: '["read","write"]'
- name: ATTRIBUTES
value: '{"perm": 72}'
- name: MOUNT_PATH
value: '/etc/config'
- name: TOTAL_CHAOS_DURATION
value: '60'
Container runtime and socket path
The CONTAINER_RUNTIME
and SOCKET_PATH
environment variables to set the container runtime and socket file path, respectively.
CONTAINER_RUNTIME
: This supportsdocker
,containerd
, andcrio
runtimes. The default value iscontainerd
.SOCKET_PATH
: This contains the path of containerd socket file by default(/run/containerd/containerd.sock
). Fordocker
, specify the path as/var/run/docker.sock
. Forcrio
, specify the path as/var/run/crio/crio.sock
.
The following YAML snippet illustrates the use of these environment variables:
## provide the container runtime and socket file path
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
annotationCheck: "false"
appinfo:
appns: "default"
applabel: "app=nginx"
appkind: "deployment"
chaosServiceAccount: litmus-admin
experiments:
- name: pod-io-attribute-override
spec:
components:
env:
# runtime for the container
# supports docker, containerd, crio
- name: CONTAINER_RUNTIME
value: 'containerd'
# path of the socket file
- name: SOCKET_PATH
value: '/run/containerd/containerd.sock'
- name: ATTRIBUTES
value: '{"perm": 72}'
- name: MOUNT_PATH
value: '/etc/config'
- name: TOTAL_CHAOS_DURATION
VALUE: '60'