Skip to main content

Generic FIS experiment template

Generic FIS experiment template provides a template to natively inject faults using FIS for different services, such as EC2, EBS, DynamoDB, and so on.

  • You need to configure and prepare an FIS template.
  • You can specify the template ID, region, and parameters to the pre-created FIS templates on HCE and execute the chaos experiments using these FIS templates.
  • You can monitor and report the results of executing the experiment from these FIS templates.

Generic experiment template

Use cases

  • Inject faults natively using FIS services.
  • Monitor and report the results of executing the experiment from the FIS templates.
  • Build chaos experiments with pre-defined templates.

Prerequisites

  • Kubernetes >= 1.17
  • The Kubernetes secret should have AWS access configuration (key) in the CHAOS_NAMESPACE. A sample secret file looks like:
    apiVersion: v1
    kind: Secret
    metadata:
    name: cloud-secret
    type: Opaque
    stringData:
    cloud_config.yml: |-
    # Add the cloud AWS credentials respectively
    [default]
    aws_access_key_id = XXXXXXXXXXXXXXXXXXX
    aws_secret_access_key = XXXXXXXXXXXXXXX
tip

HCE recommends that you 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 won't be able to use the default health check probes.

Below is an example AWS policy to execute the fault.

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"fis:CreateExperimentTemplate",
"fis:StartExperiment",
"fis:StopExperiment",
"fis:GetExperiment",
"fis:ListExperiments"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"cloudwatch:DescribeAlarms"
],
"Resource": "*"
}
]
}
note

Mandatory tunables

Tunable Description Notes
EXPERIMENT_TEMPLATE_ID Template ID that is used to inject chaos natively.
REGION Region name for the target volumes For example, us-east-1.

Optional tunables

Tunable Description Notes
TOTAL_CHAOS_DURATION Time duration for chaos insertion (sec) Default: 30 s. For more information, go to duration of the chaos.
CHAOS_INTERVAL The time duration between the attachment and detachment of the volumes (sec) Default: 30 s. For more information, go to chaos interval.
RAMP_TIME Period to wait before and after injection of chaos in sec For example, 30 s. For more information, go to ramp time.
PARAMETERS Parameters used in the FIS template.
AWS_SHARED_CREDENTIALS_FILE Path to the AWS secret credentials. Default: /tmp/cloud_config.yml.

Experiment template ID

The template ID that is used to inject chaos. Select the template, fill in the values and reference the template ID in the tunables. Tune it using the EXPERIMENT_TEMPLATE_ID environment variable.

The following YAML snippet illustrates the use of this environment variable:

kind: Workflow
apiVersion: argoproj.io/v1alpha1
metadata:
name: fis-chaos
namespace: litmus
spec:
templates:
- name: fis-chaos
spec:
components:
env:
- name: EXPERIMENT_TEMPLATE_ID
value: ''
secrets:
- name: cloud-secret
mountPath: /tmp/