ECS container volume detach provides a mechanism to detach and remove volumes associated with ECS task containers in an Amazon ECS (Elastic Container Service) task.
- This experiment allows you to test and validate the behavior of your ECS tasks when volumes are detached. You can verify the resilience and performance of your application during volume detachment scenarios, ensuring that the containers continue to function as expected.
- By detaching volumes, you can safely remove the volume associations from the containers without deleting the volumes themselves.
- By detaching unnecessary volumes, you can optimize the resource utilization within your ECS tasks. This helps to free up storage space and minimize any potential performance impact associated with unused volumes.
- Kubernetes >= 1.17
- ECS cluster running with the desired tasks and containers and familiarity with ECS service update and deployment concepts.
- Create a Kubernetes secret that has the AWS access configuration(key) in the
CHAOS_NAMESPACE. Below is a sample secret file:
# Add the cloud AWS credentials respectively
aws_access_key_id = XXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXX
It is recommended to use the same secret name, that is,
cloud-secret. Otherwise, you will need to update the
AWS_SHARED_CREDENTIALS_FILE environment variable in the fault template and you may be unable to use the default health check probes.
Here is an example AWS policy to execute the fault.
- Refer to AWS named profile for chaos to know how to use a different profile for AWS faults.
- The ECS containers should be in a healthy state before and after introducing chaos. Refer to the common attributes and AWS-specific tunables to tune the common tunables for all faults and AWS-specific tunables.
- Refer to the superset permission/policy to execute all AWS faults.
|CLUSTER_NAME||Name of the target ECS cluster|| For example, |
|SERVICE_NAME||Name of the ECS service under chaos|| For example, |
|REGION||Region name of the target ECS cluster|| For example, |
|TOTAL_CHAOS_DURATION||Duration that you specify, through which chaos is injected into the target resource (in seconds)||Defaults to 30s.|
|CHAOS_INTERVAL||Interval between successive instance terminations (in seconds)||Defaults to 30s.|
|AWS_SHARED_CREDENTIALS_FILE||Path to the AWS secret credentials|| Defaults to |
|RAMP_TIME||Period to wait before and after injecting chaos (in seconds)||For example, 30s.|
ECS Container Volume Detach
ECS container volume chaos will detach the volumes for specified chaos duration. Tune it by using the
CLUSTER_NAME environment variable.
The following YAML snippet illustrates the use of this environment variable:
# Set container image for the target ECS task
- name: ecs-container-volume-detach
- name: CLUSTER_NAME
- name: SERVICE_NAME
- name: REGION
- name: TOTAL_CHAOS_DURATION