Skip to content

Extension chaosk8s

Version 0.39.0
Repository https://github.com/chaostoolkit/chaostoolkit-kubernetes

Build Python versions Downloads

This project contains activities, such as probes and actions, you can call from your experiment through the Chaos Toolkit to perform Chaos Engineering against the Kubernetes API: killing a pod, removing a statefulset or node…

Install

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install chaostoolkit-kubernetes

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
    "title": "Do we remain available in face of pod going down?",
    "description": "We expect Kubernetes to handle the situation gracefully when a pod goes down",
    "tags": ["kubernetes"],
    "steady-state-hypothesis": {
        "title": "Verifying service remains healthy",
        "probes": [
            {
                "name": "all-our-microservices-should-be-healthy",
                "type": "probe",
                "tolerance": true,
                "provider": {
                    "type": "python",
                    "module": "chaosk8s.probes",
                    "func": "microservice_available_and_healthy",
                    "arguments": {
                        "name": "myapp"
                    }
                }
            }
        ]
    },
    "method": [
        {
            "type": "action",
            "name": "terminate-db-pod",
            "provider": {
                "type": "python",
                "module": "chaosk8s.pod.actions",
                "func": "terminate_pods",
                "arguments": {
                    "label_selector": "app=my-app",
                    "name_pattern": "my-app-[0-9]$",
                    "rand": true
                }
            },
            "pauses": {
                "after": 5
            }
        }
    ]
}

That’s it! Notice how the action gives you the way to kill one pod randomly.

Please explore the documentation to see existing probes and actions.

Low level fault injections

Note, for the network, cpu and memory stressors we rely on the fantastic Chaos Mesh project that provides a great interface to inject these faults.

You will need to install Chaos Mesh first in your cluster to use them.

Configuration

Use ~/.kube/config

If you have a valid entry in your ~/.kube/config file for the cluster you want to target, then there is nothing to be done.

You may specify KUBECONFIG to specify a different location.

$ export KUBECONFIG=/tmp/my-config

Specify the Kubernetes context

Quite often, your Kubernetes configuration contains several entries, and you need to define the one to use as a default context when it isn’t explicitly provided.

You may of course change your default using kubectl config use-context KUBERNETES_CONTEXT but you can also be explicit in your experiment as follows:

{
    "title": "Do we remain available in face of pod going down?",
    "description": "We expect Kubernetes to handle the situation gracefully when a pod goes down",
    "tags": ["kubernetes"],
    "secrets": {
        "k8s": {
            "KUBERNETES_CONTEXT": "..."
        }
    },
    "steady-state-hypothesis": {
        "title": "Verifying service remains healthy",
        "probes": [
            {
                "name": "all-our-microservices-should-be-healthy",
                "type": "probe",
                "tolerance": true,
                "secrets": ["k8s"],
                "provider": {
                    "type": "python",
                    "module": "chaosk8s.probes",
                    "func": "microservice_available_and_healthy",
                    "arguments": {
                        "name": "myapp"
                    }
                }
            }
        ]
    },
    "method": [
        {
            "type": "action",
            "name": "terminate-db-pod",
            "secrets": ["k8s"],
            "provider": {
                "type": "python",
                "module": "chaosk8s.pod.actions",
                "func": "terminate_pods",
                "arguments": {
                    "label_selector": "app=my-app",
                    "name_pattern": "my-app-[0-9]$",
                    "rand": true
                }
            },
            "pauses": {
                "after": 5
            }
        }
    ]
}

You need to specify the KUBERNETES_CONTEXT secret key to the name of the context you want the experiment to use. Make sure to also inform the actions and probes about the secret entries they should be passed "secrets": ["k8s"].

Use a Pod’s service account

When running from a pod (not your local machine or a CI for instance), the ./.kube/config file does not exist. Instead, the credentials can be found at /var/run/secrets/kubernetes.io/serviceaccount/token.

To let the extension know about this, simply set CHAOSTOOLKIT_IN_POD from the environment variable of the pod specification:

env:
- name: CHAOSTOOLKIT_IN_POD
  value: "true"

Pass all credentials in the experiment

Finally, you may pass explicitly all required credentials information to the experiment as follows:

Using an API key

{
    "secrets": {
        "kubernetes": {
            "KUBERNETES_HOST": "http://somehost",
            "KUBERNETES_API_KEY": {
                "type": "env",
                "key": "SOME_ENV_VAR"
            }
        }
    }
}

Using a username/password

{
    "secrets": {
        "kubernetes": {
            "KUBERNETES_HOST": "http://somehost",
            "KUBERNETES_USERNAME": {
                "type": "env",
                "key": "SOME_ENV_VAR"
            },
            "KUBERNETES_PASSWORD": {
                "type": "env",
                "key": "SOME_ENV_VAR"
            }
        }
    }
}

Using a TLS key/certificate

{
    "secrets": {
        "kubernetes": {
            "KUBERNETES_HOST": "http://somehost",
            "KUBERNETES_CERT_FILE": {
                "type": "env",
                "key": "SOME_ENV_VAR"
            },
            "KUBERNETES_KEY_FILE": {
                "type": "env",
                "key": "SOME_ENV_VAR"
            }
        }
    }
}

Managed Kubernetes Clusters Authentication

On some managed Kubernetes clusters, you also need to authenticate against the platform itself because the Kubernetes authentication is delegated to it.

Google Cloud Platform

In addition to your Kubernetes credentials (via the ~/.kube/config file), you need to authenticate against the Google Cloud Platform itself. Usually this is done via:

$ gcloud auth login

But can also be achieved by defining the GOOGLE_APPLICATION_CREDENTIALS environment variable.

Contribute

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, write unit tests to cover the proposed changes, implement the changes, ensure they meet the formatting standards and then raise a PR to the repository for review.

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on each commit they would like to merge into the master branch of the repository. Please, make sure you can abide by the rules of the DCO before submitting a PR.

Develop

If you wish to develop on this project, make sure to install the development dependencies. But first, install PDM and then install the dependencies.

$ pdm install

Now, you can edit the files, and they will be automatically be seen by your environment, even when running from the chaos command locally.

Tests

To run the tests for the project execute the following:

$ pdm run tests

Formatting and Linting

We use ruff to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ pdm run format

This will automatically format any code that doesn’t adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ pdm run lint

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

Exported Activities

actions


kill_microservice

Type action
Module chaosk8s.actions
Name kill_microservice
Return None

!!!DEPRECATED!!!

Signature:

def kill_microservice(name: str,
                      ns: str = 'default',
                      label_selector: str = 'name in ({name})',
                      secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string “name in ({name})” No

Usage:

{
  "name": "kill-microservice",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.actions",
    "func": "kill_microservice",
    "arguments": {
      "name": ""
    }
  }
}
name: kill-microservice
provider:
  arguments:
    name: ''
  func: kill_microservice
  module: chaosk8s.actions
  type: python
type: action

remove_service_endpoint

Type action
Module chaosk8s.actions
Name remove_service_endpoint
Return None

!!!DEPRECATED!!!

Signature:

def remove_service_endpoint(name: str,
                            ns: str = 'default',
                            secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "remove-service-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.actions",
    "func": "remove_service_endpoint",
    "arguments": {
      "name": ""
    }
  }
}
name: remove-service-endpoint
provider:
  arguments:
    name: ''
  func: remove_service_endpoint
  module: chaosk8s.actions
  type: python
type: action

scale_microservice

Type action
Module chaosk8s.actions
Name scale_microservice
Return None

!!!DEPRECATED!!!

Signature:

def scale_microservice(name: str,
                       replicas: int,
                       ns: str = 'default',
                       secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
replicas integer Yes
ns string “default” No

Usage:

{
  "name": "scale-microservice",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.actions",
    "func": "scale_microservice",
    "arguments": {
      "name": "",
      "replicas": 0
    }
  }
}
name: scale-microservice
provider:
  arguments:
    name: ''
    replicas: 0
  func: scale_microservice
  module: chaosk8s.actions
  type: python
type: action

start_microservice

Type action
Module chaosk8s.actions
Name start_microservice
Return None

!!!DEPRECATED!!!

Signature:

def start_microservice(spec_path: str,
                       ns: str = 'default',
                       secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
spec_path string Yes
ns string “default” No

Usage:

{
  "name": "start-microservice",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.actions",
    "func": "start_microservice",
    "arguments": {
      "spec_path": ""
    }
  }
}
name: start-microservice
provider:
  arguments:
    spec_path: ''
  func: start_microservice
  module: chaosk8s.actions
  type: python
type: action

network


add_latency

Type action
Module chaosk8s.chaosmesh.network.actions
Name add_latency
Return mapping

Set network delay on a pod.

You may set the argument starting with target to be specific about the network link you want to impact.

When setting the direction to either from or both, then a target must be set.

See: https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes/ See: https://github.com/chaos-mesh/chaos-mesh/blob/master/config/crd/bases/chaos-mesh.org_networkchaos.yaml

Signature:

def add_latency(name: str,
                ns: str = 'default',
                namespaces_selectors: Union[str, List[str], NoneType] = None,
                label_selectors: Union[str, Dict[str, Any], NoneType] = None,
                annotations_selectors: Union[str, Dict[str, Any],
                                             NoneType] = None,
                mode: str = 'one',
                mode_value: Optional[str] = None,
                direction: str = 'to',
                latency: Optional[str] = None,
                correlation: Optional[str] = None,
                jitter: Optional[str] = None,
                external_targets: Union[str, List[str], NoneType] = None,
                target_mode: Optional[str] = 'one',
                target_mode_value: Optional[str] = None,
                target_namespaces_selectors: Union[str, List[str],
                                                   NoneType] = None,
                target_label_selectors: Union[str, Dict[str, Any],
                                              NoneType] = None,
                target_annotations_selectors: Union[str, Dict[str, Any],
                                                    NoneType] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
namespaces_selectors object null No
label_selectors object null No
annotations_selectors object null No
mode string “one” No
mode_value object null No
direction string “to” No
latency object null No
correlation object null No
jitter object null No
external_targets object null No
target_mode object “one” No
target_mode_value object null No
target_namespaces_selectors object null No
target_label_selectors object null No
target_annotations_selectors object null No

Usage:

{
  "name": "add-latency",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.actions",
    "func": "add_latency",
    "arguments": {
      "name": ""
    }
  }
}
name: add-latency
provider:
  arguments:
    name: ''
  func: add_latency
  module: chaosk8s.chaosmesh.network.actions
  type: python
type: action

corrupt_packets

Type action
Module chaosk8s.chaosmesh.network.actions
Name corrupt_packets
Return mapping

Corrupt network packets on a pod.

When setting the direction to either from or both, then a target must be set.

See: https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes/

Signature:

def corrupt_packets(
        name: str,
        ns: str = 'default',
        namespaces_selectors: Optional[str] = None,
        label_selectors: Optional[str] = None,
        annotations_selectors: Optional[str] = None,
        mode: str = 'one',
        mode_value: Optional[str] = None,
        direction: str = 'to',
        corrupt: Optional[str] = None,
        correlation: Optional[str] = None,
        external_targets: Union[str, List[str], NoneType] = None,
        target_mode: Optional[str] = 'one',
        target_mode_value: Optional[str] = None,
        target_namespaces_selectors: Union[str, List[str], NoneType] = None,
        target_label_selectors: Union[str, Dict[str, Any], NoneType] = None,
        target_annotations_selectors: Union[str, Dict[str, Any],
                                            NoneType] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
namespaces_selectors object null No
label_selectors object null No
annotations_selectors object null No
mode string “one” No
mode_value object null No
direction string “to” No
corrupt object null No
correlation object null No
external_targets object null No
target_mode object “one” No
target_mode_value object null No
target_namespaces_selectors object null No
target_label_selectors object null No
target_annotations_selectors object null No

Usage:

{
  "name": "corrupt-packets",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.actions",
    "func": "corrupt_packets",
    "arguments": {
      "name": ""
    }
  }
}
name: corrupt-packets
provider:
  arguments:
    name: ''
  func: corrupt_packets
  module: chaosk8s.chaosmesh.network.actions
  type: python
type: action

delete_network_fault

Type action
Module chaosk8s.chaosmesh.network.actions
Name delete_network_fault
Return mapping

Remove a Chaos Mesh network fault.

Signature:

def delete_network_fault(
        name: str,
        ns: str = 'default',
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "delete-network-fault",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.actions",
    "func": "delete_network_fault",
    "arguments": {
      "name": ""
    }
  }
}
name: delete-network-fault
provider:
  arguments:
    name: ''
  func: delete_network_fault
  module: chaosk8s.chaosmesh.network.actions
  type: python
type: action

duplicate_packets

Type action
Module chaosk8s.chaosmesh.network.actions
Name duplicate_packets
Return mapping

Duplicate network packets on a pod.

When setting the direction to either from or both, then a target must be set.

See: https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes/

Signature:

def duplicate_packets(
        name: str,
        ns: str = 'default',
        namespaces_selectors: Optional[str] = None,
        label_selectors: Optional[str] = None,
        annotations_selectors: Optional[str] = None,
        mode: str = 'one',
        mode_value: Optional[str] = None,
        direction: str = 'to',
        duplicate: Optional[str] = None,
        correlation: Optional[str] = None,
        external_targets: Union[str, List[str], NoneType] = None,
        target_mode: Optional[str] = 'one',
        target_mode_value: Optional[str] = None,
        target_namespaces_selectors: Union[str, List[str], NoneType] = None,
        target_label_selectors: Union[str, Dict[str, Any], NoneType] = None,
        target_annotations_selectors: Union[str, Dict[str, Any],
                                            NoneType] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
namespaces_selectors object null No
label_selectors object null No
annotations_selectors object null No
mode string “one” No
mode_value object null No
direction string “to” No
duplicate object null No
correlation object null No
external_targets object null No
target_mode object “one” No
target_mode_value object null No
target_namespaces_selectors object null No
target_label_selectors object null No
target_annotations_selectors object null No

Usage:

{
  "name": "duplicate-packets",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.actions",
    "func": "duplicate_packets",
    "arguments": {
      "name": ""
    }
  }
}
name: duplicate-packets
provider:
  arguments:
    name: ''
  func: duplicate_packets
  module: chaosk8s.chaosmesh.network.actions
  type: python
type: action

get_network_fault

Type probe
Module chaosk8s.chaosmesh.network.probes
Name get_network_fault
Return mapping

Get a specific Chaos Mesh network fault.

Signature:

def get_network_fault(
        name: str,
        ns: str = 'default',
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "get-network-fault",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.probes",
    "func": "get_network_fault",
    "arguments": {
      "name": ""
    }
  }
}
name: get-network-fault
provider:
  arguments:
    name: ''
  func: get_network_fault
  module: chaosk8s.chaosmesh.network.probes
  type: python
type: probe

get_network_faults

Type probe
Module chaosk8s.chaosmesh.network.probes
Name get_network_faults
Return mapping

List all Chaos Mesh network faults.

Signature:

def get_network_faults(
        ns: str = 'default',
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
ns string “default” No

Usage:

{
  "name": "get-network-faults",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.probes",
    "func": "get_network_faults"
  }
}
name: get-network-faults
provider:
  func: get_network_faults
  module: chaosk8s.chaosmesh.network.probes
  type: python
type: probe

reorder_packets

Type action
Module chaosk8s.chaosmesh.network.actions
Name reorder_packets
Return mapping

Reorder network packets on a pod.

When setting the direction to either from or both, then a target must be set.

See: https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes/

Signature:

def reorder_packets(
        name: str,
        ns: str = 'default',
        namespaces_selectors: Optional[str] = None,
        label_selectors: Optional[str] = None,
        annotations_selectors: Optional[str] = None,
        mode: str = 'one',
        mode_value: Optional[str] = None,
        direction: str = 'to',
        reorder: Optional[str] = None,
        correlation: Optional[str] = None,
        gap: Optional[str] = None,
        external_targets: Union[str, List[str], NoneType] = None,
        target_mode: Optional[str] = 'one',
        target_mode_value: Optional[str] = None,
        target_namespaces_selectors: Union[str, List[str], NoneType] = None,
        target_label_selectors: Union[str, Dict[str, Any], NoneType] = None,
        target_annotations_selectors: Union[str, Dict[str, Any],
                                            NoneType] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
namespaces_selectors object null No
label_selectors object null No
annotations_selectors object null No
mode string “one” No
mode_value object null No
direction string “to” No
reorder object null No
correlation object null No
gap object null No
external_targets object null No
target_mode object “one” No
target_mode_value object null No
target_namespaces_selectors object null No
target_label_selectors object null No
target_annotations_selectors object null No

Usage:

{
  "name": "reorder-packets",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.actions",
    "func": "reorder_packets",
    "arguments": {
      "name": ""
    }
  }
}
name: reorder-packets
provider:
  arguments:
    name: ''
  func: reorder_packets
  module: chaosk8s.chaosmesh.network.actions
  type: python
type: action

set_bandwidth

Type action
Module chaosk8s.chaosmesh.network.actions
Name set_bandwidth
Return mapping

Simulate bandwdith on a pod.

When setting the direction to either from or both, then a target must be set.

See: https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes/

Signature:

def set_bandwidth(name: str,
                  rate: str,
                  limit: int,
                  buffer: int,
                  ns: str = 'default',
                  namespaces_selectors: Optional[str] = None,
                  label_selectors: Optional[str] = None,
                  annotations_selectors: Optional[str] = None,
                  mode: str = 'one',
                  mode_value: Optional[str] = None,
                  direction: str = 'to',
                  peakrate: Optional[int] = None,
                  minburst: Optional[int] = None,
                  external_targets: Union[str, List[str], NoneType] = None,
                  target_mode: Optional[str] = 'one',
                  target_mode_value: Optional[str] = None,
                  target_namespaces_selectors: Union[str, List[str],
                                                     NoneType] = None,
                  target_label_selectors: Union[str, Dict[str, Any],
                                                NoneType] = None,
                  target_annotations_selectors: Union[str, Dict[str, Any],
                                                      NoneType] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
rate string Yes
limit integer Yes
buffer integer Yes
ns string “default” No
namespaces_selectors object null No
label_selectors object null No
annotations_selectors object null No
mode string “one” No
mode_value object null No
direction string “to” No
peakrate object null No
minburst object null No
external_targets object null No
target_mode object “one” No
target_mode_value object null No
target_namespaces_selectors object null No
target_label_selectors object null No
target_annotations_selectors object null No

Usage:

{
  "name": "set-bandwidth",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.actions",
    "func": "set_bandwidth",
    "arguments": {
      "name": "",
      "rate": "",
      "limit": 0,
      "buffer": 0
    }
  }
}
name: set-bandwidth
provider:
  arguments:
    buffer: 0
    limit: 0
    name: ''
    rate: ''
  func: set_bandwidth
  module: chaosk8s.chaosmesh.network.actions
  type: python
type: action

set_loss

Type action
Module chaosk8s.chaosmesh.network.actions
Name set_loss
Return mapping

Set network loss on a pod.

You may set the argument starting with target to be specific about the network link you want to impact.

When setting the direction to either from or both, then a target must be set.

See: https://chaos-mesh.org/docs/simulate-network-chaos-on-kubernetes/

Signature:

def set_loss(name: str,
             ns: str = 'default',
             namespaces_selectors: Optional[str] = None,
             label_selectors: Optional[str] = None,
             annotations_selectors: Optional[str] = None,
             mode: str = 'one',
             mode_value: Optional[str] = None,
             direction: str = 'to',
             loss: Optional[str] = None,
             correlation: Optional[str] = None,
             external_targets: Union[str, List[str], NoneType] = None,
             target_mode: Optional[str] = 'one',
             target_mode_value: Optional[str] = None,
             target_namespaces_selectors: Union[str, List[str],
                                                NoneType] = None,
             target_label_selectors: Union[str, Dict[str, Any],
                                           NoneType] = None,
             target_annotations_selectors: Union[str, Dict[str, Any],
                                                 NoneType] = None,
             secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
namespaces_selectors object null No
label_selectors object null No
annotations_selectors object null No
mode string “one” No
mode_value object null No
direction string “to” No
loss object null No
correlation object null No
external_targets object null No
target_mode object “one” No
target_mode_value object null No
target_namespaces_selectors object null No
target_label_selectors object null No
target_annotations_selectors object null No

Usage:

{
  "name": "set-loss",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.network.actions",
    "func": "set_loss",
    "arguments": {
      "name": ""
    }
  }
}
name: set-loss
provider:
  arguments:
    name: ''
  func: set_loss
  module: chaosk8s.chaosmesh.network.actions
  type: python
type: action

stress


delete_stressor

Type action
Module chaosk8s.chaosmesh.stress.actions
Name delete_stressor
Return mapping

Remove a Chaos Mesh stressor.

Signature:

def delete_stressor(
        name: str,
        ns: str = 'default',
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "delete-stressor",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.stress.actions",
    "func": "delete_stressor",
    "arguments": {
      "name": ""
    }
  }
}
name: delete-stressor
provider:
  arguments:
    name: ''
  func: delete_stressor
  module: chaosk8s.chaosmesh.stress.actions
  type: python
type: action

get_stressor

Type probe
Module chaosk8s.chaosmesh.stress.probes
Name get_stressor
Return mapping

Get a specific Chaos Mesh CPU/memory stressor.

Signature:

def get_stressor(name: str,
                 ns: str = 'default',
                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "get-stressor",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.stress.probes",
    "func": "get_stressor",
    "arguments": {
      "name": ""
    }
  }
}
name: get-stressor
provider:
  arguments:
    name: ''
  func: get_stressor
  module: chaosk8s.chaosmesh.stress.probes
  type: python
type: probe

get_stressors

Type probe
Module chaosk8s.chaosmesh.stress.probes
Name get_stressors
Return mapping

List all Chaos Mesh network CPU/memory stressors.

Signature:

def get_stressors(ns: str = 'default',
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
ns string “default” No

Usage:

{
  "name": "get-stressors",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.stress.probes",
    "func": "get_stressors"
  }
}
name: get-stressors
provider:
  func: get_stressors
  module: chaosk8s.chaosmesh.stress.probes
  type: python
type: probe

stress_cpu

Type action
Module chaosk8s.chaosmesh.stress.actions
Name stress_cpu
Return mapping

Stress the CPU to impact a process/container.

See: https://chaos-mesh.org/docs/simulate-heavy-stress-on-kubernetes/

Signature:

def stress_cpu(name: str,
               workers: int,
               load: int,
               ns: str = 'default',
               namespaces_selectors: Optional[str] = None,
               label_selectors: Optional[str] = None,
               annotations_selectors: Optional[str] = None,
               mode: str = 'one',
               mode_value: Optional[str] = None,
               direction: str = 'to',
               duration: str = '30s',
               container_names: Union[str, List[str], NoneType] = None,
               stressng_stressors: Optional[str] = None,
               secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
workers integer Yes
load integer Yes
ns string “default” No
namespaces_selectors object null No
label_selectors object null No
annotations_selectors object null No
mode string “one” No
mode_value object null No
direction string “to” No
duration string “30s” No
container_names object null No
stressng_stressors object null No

Usage:

{
  "name": "stress-cpu",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.stress.actions",
    "func": "stress_cpu",
    "arguments": {
      "name": "",
      "workers": 0,
      "load": 0
    }
  }
}
name: stress-cpu
provider:
  arguments:
    load: 0
    name: ''
    workers: 0
  func: stress_cpu
  module: chaosk8s.chaosmesh.stress.actions
  type: python
type: action

stress_memory

Type action
Module chaosk8s.chaosmesh.stress.actions
Name stress_memory
Return mapping

Stress the memory to impact a process/container.

See: https://chaos-mesh.org/docs/simulate-heavy-stress-on-kubernetes/

Signature:

def stress_memory(name: str,
                  workers: Optional[int] = None,
                  size: Optional[str] = None,
                  oom_score: Optional[int] = None,
                  time_to_get_to_size: Optional[str] = None,
                  ns: str = 'default',
                  namespaces_selectors: Optional[str] = None,
                  label_selectors: Optional[str] = None,
                  annotations_selectors: Optional[str] = None,
                  mode: str = 'one',
                  mode_value: Optional[str] = None,
                  direction: str = 'to',
                  duration: str = '30s',
                  container_names: Union[str, List[str], NoneType] = None,
                  stressng_stressors: Optional[str] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
workers object null No
size object null No
oom_score object null No
time_to_get_to_size object null No
ns string “default” No
namespaces_selectors object null No
label_selectors object null No
annotations_selectors object null No
mode string “one” No
mode_value object null No
direction string “to” No
duration string “30s” No
container_names object null No
stressng_stressors object null No

Usage:

{
  "name": "stress-memory",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.chaosmesh.stress.actions",
    "func": "stress_memory",
    "arguments": {
      "name": ""
    }
  }
}
name: stress-memory
provider:
  arguments:
    name: ''
  func: stress_memory
  module: chaosk8s.chaosmesh.stress.actions
  type: python
type: action

crd


apply_from_json

Type action
Module chaosk8s.crd.actions
Name apply_from_json
Return mapping

Apply the given custom resource, given as a JSON string, to the cluster.

Signature:

def apply_from_json(
        resource: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
resource string null No

Usage:

{
  "name": "apply-from-json",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "apply_from_json"
  }
}
name: apply-from-json
provider:
  func: apply_from_json
  module: chaosk8s.crd.actions
  type: python
type: action

apply_from_yaml

Type action
Module chaosk8s.crd.actions
Name apply_from_yaml
Return mapping

Apply the given custom resource, given as a YAML string, to the cluster.

Signature:

def apply_from_yaml(
        resource: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
resource string null No

Usage:

{
  "name": "apply-from-yaml",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "apply_from_yaml"
  }
}
name: apply-from-yaml
provider:
  func: apply_from_yaml
  module: chaosk8s.crd.actions
  type: python
type: action

create_cluster_custom_object

Type action
Module chaosk8s.crd.actions
Name create_cluster_custom_object
Return mapping

Delete a custom object in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def create_cluster_custom_object(
        group: str,
        version: str,
        plural: str,
        resource: Dict[str, Any] = None,
        resource_as_yaml_file: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
resource mapping null No
resource_as_yaml_file string null No

Usage:

{
  "name": "create-cluster-custom-object",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "create_cluster_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": ""
    }
  }
}
name: create-cluster-custom-object
provider:
  arguments:
    group: ''
    plural: ''
    version: ''
  func: create_cluster_custom_object
  module: chaosk8s.crd.actions
  type: python
type: action

create_custom_object

Type action
Module chaosk8s.crd.actions
Name create_custom_object
Return mapping

Create a custom object in the given namespace. Its custom resource definition must already exists or this will fail with a 404.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def create_custom_object(
        group: str,
        version: str,
        plural: str,
        ns: str = 'default',
        resource: Dict[str, Any] = None,
        resource_as_yaml_file: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
ns string “default” No
resource mapping null No
resource_as_yaml_file string null No

Usage:

{
  "name": "create-custom-object",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "create_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": ""
    }
  }
}
name: create-custom-object
provider:
  arguments:
    group: ''
    plural: ''
    version: ''
  func: create_custom_object
  module: chaosk8s.crd.actions
  type: python
type: action

delete_cluster_custom_object

Type action
Module chaosk8s.crd.actions
Name delete_cluster_custom_object
Return mapping

Delete a custom object cluster wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def delete_cluster_custom_object(
        group: str,
        version: str,
        plural: str,
        name: str,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
name string Yes

Usage:

{
  "name": "delete-cluster-custom-object",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "delete_cluster_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": "",
      "name": ""
    }
  }
}
name: delete-cluster-custom-object
provider:
  arguments:
    group: ''
    name: ''
    plural: ''
    version: ''
  func: delete_cluster_custom_object
  module: chaosk8s.crd.actions
  type: python
type: action

delete_custom_object

Type action
Module chaosk8s.crd.actions
Name delete_custom_object
Return mapping

Create a custom object cluster wide. Its custom resource definition must already exists or this will fail with a 404.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def delete_custom_object(
        group: str,
        version: str,
        plural: str,
        name: str,
        ns: str = 'default',
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
name string Yes
ns string “default” No

Usage:

{
  "name": "delete-custom-object",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "delete_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": "",
      "name": ""
    }
  }
}
name: delete-custom-object
provider:
  arguments:
    group: ''
    name: ''
    plural: ''
    version: ''
  func: delete_custom_object
  module: chaosk8s.crd.actions
  type: python
type: action

get_cluster_custom_object

Type probe
Module chaosk8s.crd.probes
Name get_cluster_custom_object
Return mapping

Get a custom object cluster-wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def get_cluster_custom_object(
        group: str,
        version: str,
        plural: str,
        name: str,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
name string Yes

Usage:

{
  "name": "get-cluster-custom-object",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.probes",
    "func": "get_cluster_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": "",
      "name": ""
    }
  }
}
name: get-cluster-custom-object
provider:
  arguments:
    group: ''
    name: ''
    plural: ''
    version: ''
  func: get_cluster_custom_object
  module: chaosk8s.crd.probes
  type: python
type: probe

get_custom_object

Type probe
Module chaosk8s.crd.probes
Name get_custom_object
Return mapping

Get a custom object in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def get_custom_object(
        group: str,
        version: str,
        plural: str,
        name: str,
        ns: str = 'default',
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
name string Yes
ns string “default” No

Usage:

{
  "name": "get-custom-object",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.probes",
    "func": "get_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": "",
      "name": ""
    }
  }
}
name: get-custom-object
provider:
  arguments:
    group: ''
    name: ''
    plural: ''
    version: ''
  func: get_custom_object
  module: chaosk8s.crd.probes
  type: python
type: probe

list_cluster_custom_objects

Type probe
Module chaosk8s.crd.probes
Name list_cluster_custom_objects
Return list

List custom objects cluster-wide.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def list_cluster_custom_objects(
        group: str,
        version: str,
        plural: str,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes

Usage:

{
  "name": "list-cluster-custom-objects",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.probes",
    "func": "list_cluster_custom_objects",
    "arguments": {
      "group": "",
      "version": "",
      "plural": ""
    }
  }
}
name: list-cluster-custom-objects
provider:
  arguments:
    group: ''
    plural: ''
    version: ''
  func: list_cluster_custom_objects
  module: chaosk8s.crd.probes
  type: python
type: probe

list_custom_objects

Type probe
Module chaosk8s.crd.probes
Name list_custom_objects
Return list

List custom objects in the given namespace.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def list_custom_objects(
        group: str,
        version: str,
        plural: str,
        ns: str = 'default',
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
ns string “default” No

Usage:

{
  "name": "list-custom-objects",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.probes",
    "func": "list_custom_objects",
    "arguments": {
      "group": "",
      "version": "",
      "plural": ""
    }
  }
}
name: list-custom-objects
provider:
  arguments:
    group: ''
    plural: ''
    version: ''
  func: list_custom_objects
  module: chaosk8s.crd.probes
  type: python
type: probe

patch_cluster_custom_object

Type action
Module chaosk8s.crd.actions
Name patch_cluster_custom_object
Return mapping

Patch a custom object cluster-wide. The resource must be the updated version to apply. Force will re-acquire conflicting fields owned by others.

The resource, or resource_as_yaml_file, must be a JSON Patch document.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def patch_cluster_custom_object(
        group: str,
        version: str,
        plural: str,
        name: str,
        force: bool = False,
        resource: Dict[str, Any] = None,
        resource_as_yaml_file: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
name string Yes
force boolean false No
resource mapping null No
resource_as_yaml_file string null No

Usage:

{
  "name": "patch-cluster-custom-object",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "patch_cluster_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": "",
      "name": ""
    }
  }
}
name: patch-cluster-custom-object
provider:
  arguments:
    group: ''
    name: ''
    plural: ''
    version: ''
  func: patch_cluster_custom_object
  module: chaosk8s.crd.actions
  type: python
type: action

patch_custom_object

Type action
Module chaosk8s.crd.actions
Name patch_custom_object
Return mapping

Patch a custom object in the given namespace. The resource must be the updated version to apply. Force will re-acquire conflicting fields owned by others.

The resource, or resource_as_yaml_file, must be a JSON Patch document.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def patch_custom_object(
        group: str,
        version: str,
        plural: str,
        name: str,
        ns: str = 'default',
        force: bool = False,
        resource: Dict[str, Any] = None,
        resource_as_yaml_file: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
name string Yes
ns string “default” No
force boolean false No
resource mapping null No
resource_as_yaml_file string null No

Usage:

{
  "name": "patch-custom-object",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "patch_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": "",
      "name": ""
    }
  }
}
name: patch-custom-object
provider:
  arguments:
    group: ''
    name: ''
    plural: ''
    version: ''
  func: patch_custom_object
  module: chaosk8s.crd.actions
  type: python
type: action

replace_cluster_custom_object

Type action
Module chaosk8s.crd.actions
Name replace_cluster_custom_object
Return mapping

Replace a custom object in the given namespace. The resource must be the new version to apply.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def replace_cluster_custom_object(
        group: str,
        version: str,
        plural: str,
        name: str,
        force: bool = False,
        resource: Dict[str, Any] = None,
        resource_as_yaml_file: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
name string Yes
force boolean false No
resource mapping null No
resource_as_yaml_file string null No

Usage:

{
  "name": "replace-cluster-custom-object",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "replace_cluster_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": "",
      "name": ""
    }
  }
}
name: replace-cluster-custom-object
provider:
  arguments:
    group: ''
    name: ''
    plural: ''
    version: ''
  func: replace_cluster_custom_object
  module: chaosk8s.crd.actions
  type: python
type: action

replace_custom_object

Type action
Module chaosk8s.crd.actions
Name replace_custom_object
Return mapping

Replace a custom object in the given namespace. The resource must be the new version to apply.

Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Signature:

def replace_custom_object(
        group: str,
        version: str,
        plural: str,
        name: str,
        ns: str = 'default',
        force: bool = False,
        resource: Dict[str, Any] = None,
        resource_as_yaml_file: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
group string Yes
version string Yes
plural string Yes
name string Yes
ns string “default” No
force boolean false No
resource mapping null No
resource_as_yaml_file string null No

Usage:

{
  "name": "replace-custom-object",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.crd.actions",
    "func": "replace_custom_object",
    "arguments": {
      "group": "",
      "version": "",
      "plural": "",
      "name": ""
    }
  }
}
name: replace-custom-object
provider:
  arguments:
    group: ''
    name: ''
    plural: ''
    version: ''
  func: replace_custom_object
  module: chaosk8s.crd.actions
  type: python
type: action

daemonset


create_daemon_set

Type action
Module chaosk8s.daemonset.actions
Name create_daemon_set
Return None

Create a daemon set described by the daemon set spec, which must be the path to the JSON or YAML representation of the daemon_set.

Signature:

def create_daemon_set(spec_path: str,
                      ns: str = 'default',
                      secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
spec_path string Yes
ns string “default” No

Usage:

{
  "name": "create-daemon-set",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.daemonset.actions",
    "func": "create_daemon_set",
    "arguments": {
      "spec_path": ""
    }
  }
}
name: create-daemon-set
provider:
  arguments:
    spec_path: ''
  func: create_daemon_set
  module: chaosk8s.daemonset.actions
  type: python
type: action

daemon_set_available_and_healthy

Type probe
Module chaosk8s.daemonset.probes
Name daemon_set_available_and_healthy
Return boolean

Lookup a daemon set by name in the namespace ns.

The selected resources are matched by the given label_selector.

Return True if daemon set is available, otherwise False.

Signature:

def daemon_set_available_and_healthy(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No

Usage:

{
  "name": "daemon-set-available-and-healthy",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.daemonset.probes",
    "func": "daemon_set_available_and_healthy",
    "arguments": {
      "name": ""
    }
  }
}
name: daemon-set-available-and-healthy
provider:
  arguments:
    name: ''
  func: daemon_set_available_and_healthy
  module: chaosk8s.daemonset.probes
  type: python
type: probe

daemon_set_fully_available

Type probe
Module chaosk8s.daemonset.probes
Name daemon_set_fully_available
Return boolean

Wait until all the daemon set expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, return False

Signature:

def daemon_set_fully_available(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        timeout: int = 30,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
timeout integer 30 No

Usage:

{
  "name": "daemon-set-fully-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.daemonset.probes",
    "func": "daemon_set_fully_available",
    "arguments": {
      "name": ""
    }
  }
}
name: daemon-set-fully-available
provider:
  arguments:
    name: ''
  func: daemon_set_fully_available
  module: chaosk8s.daemonset.probes
  type: python
type: probe

daemon_set_not_fully_available

Type probe
Module chaosk8s.daemonset.probes
Name daemon_set_not_fully_available
Return boolean

Wait until the daemon set gets into an intermediate state where not all expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, return False.

Signature:

def daemon_set_not_fully_available(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        timeout: int = 30,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
timeout integer 30 No

Usage:

{
  "name": "daemon-set-not-fully-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.daemonset.probes",
    "func": "daemon_set_not_fully_available",
    "arguments": {
      "name": ""
    }
  }
}
name: daemon-set-not-fully-available
provider:
  arguments:
    name: ''
  func: daemon_set_not_fully_available
  module: chaosk8s.daemonset.probes
  type: python
type: probe

daemon_set_partially_available

Type probe
Module chaosk8s.daemonset.probes
Name daemon_set_partially_available
Return boolean

Check whether if the given daemon set state is ready or at-least partially ready. Return True if dameon set is partially available, otherwise False

Signature:

def daemon_set_partially_available(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No

Usage:

{
  "name": "daemon-set-partially-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.daemonset.probes",
    "func": "daemon_set_partially_available",
    "arguments": {
      "name": ""
    }
  }
}
name: daemon-set-partially-available
provider:
  arguments:
    name: ''
  func: daemon_set_partially_available
  module: chaosk8s.daemonset.probes
  type: python
type: probe

delete_daemon_set

Type action
Module chaosk8s.daemonset.actions
Name delete_daemon_set
Return None

Delete a daemon set by name or label_selector in the namespace ns.

The daemon set is deleted without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the daemon sets will be deleted in the namespace.

Signature:

def delete_daemon_set(name: str = None,
                      ns: str = 'default',
                      label_selector: str = None,
                      secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string null No
ns string “default” No
label_selector string null No

Usage:

{
  "name": "delete-daemon-set",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.daemonset.actions",
    "func": "delete_daemon_set"
  }
}
name: delete-daemon-set
provider:
  func: delete_daemon_set
  module: chaosk8s.daemonset.actions
  type: python
type: action

update_daemon_set

Type action
Module chaosk8s.daemonset.actions
Name update_daemon_set
Return None

Update the specification of the targeted daemon set according to spec.

Signature:

def update_daemon_set(name: str,
                      spec: dict,
                      ns: str = 'default',
                      secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
spec mapping Yes
ns string “default” No

Usage:

{
  "name": "update-daemon-set",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.daemonset.actions",
    "func": "update_daemon_set",
    "arguments": {
      "name": "",
      "spec": {}
    }
  }
}
name: update-daemon-set
provider:
  arguments:
    name: ''
    spec: {}
  func: update_daemon_set
  module: chaosk8s.daemonset.actions
  type: python
type: action

deployment


create_deployment

Type action
Module chaosk8s.deployment.actions
Name create_deployment
Return None

Create a deployment described by the deployment config, which must be the path to the JSON or YAML representation of the deployment.

Signature:

def create_deployment(spec_path: str,
                      ns: str = 'default',
                      secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
spec_path string Yes
ns string “default” No

Usage:

{
  "name": "create-deployment",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.deployment.actions",
    "func": "create_deployment",
    "arguments": {
      "spec_path": ""
    }
  }
}
name: create-deployment
provider:
  arguments:
    spec_path: ''
  func: create_deployment
  module: chaosk8s.deployment.actions
  type: python
type: action

delete_deployment

Type action
Module chaosk8s.deployment.actions
Name delete_deployment
Return None

Delete a deployment by name or label_selector in the namespace ns.

The deployment is deleted without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the deployments will be deleted in the namespace.

Signature:

def delete_deployment(name: str = None,
                      ns: str = 'default',
                      label_selector: str = None,
                      secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string null No
ns string “default” No
label_selector string null No

Usage:

{
  "name": "delete-deployment",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.deployment.actions",
    "func": "delete_deployment"
  }
}
name: delete-deployment
provider:
  func: delete_deployment
  module: chaosk8s.deployment.actions
  type: python
type: action

deployment_available_and_healthy

Type probe
Module chaosk8s.deployment.probes
Name deployment_available_and_healthy
Return Optional[bool]

Lookup a deployment by name in the namespace ns.

The selected resources are matched by the given label_selector.

Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected. Unless raise_on_unavailable is set to False which means the probe will return False rather than raise the exception.

Signature:

def deployment_available_and_healthy(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        raise_on_unavailable: bool = True,
        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
raise_on_unavailable boolean true No

Usage:

{
  "name": "deployment-available-and-healthy",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.deployment.probes",
    "func": "deployment_available_and_healthy",
    "arguments": {
      "name": ""
    }
  }
}
name: deployment-available-and-healthy
provider:
  arguments:
    name: ''
  func: deployment_available_and_healthy
  module: chaosk8s.deployment.probes
  type: python
type: probe

deployment_fully_available

Type probe
Module chaosk8s.deployment.probes
Name deployment_fully_available
Return Optional[bool]

Wait until all the deployment expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_not_fully_available is set to False, return False instead of raising the exception.

Signature:

def deployment_fully_available(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        timeout: int = 30,
        raise_on_not_fully_available: bool = True,
        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
timeout integer 30 No
raise_on_not_fully_available boolean true No

Usage:

{
  "name": "deployment-fully-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.deployment.probes",
    "func": "deployment_fully_available",
    "arguments": {
      "name": ""
    }
  }
}
name: deployment-fully-available
provider:
  arguments:
    name: ''
  func: deployment_fully_available
  module: chaosk8s.deployment.probes
  type: python
type: probe

deployment_not_fully_available

Type probe
Module chaosk8s.deployment.probes
Name deployment_not_fully_available
Return Optional[bool]

Wait until the deployment gets into an intermediate state where not all expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_fully_available is set to False, return False instead of raising the exception.

Signature:

def deployment_not_fully_available(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        timeout: int = 30,
        raise_on_fully_available: bool = True,
        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
timeout integer 30 No
raise_on_fully_available boolean true No

Usage:

{
  "name": "deployment-not-fully-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.deployment.probes",
    "func": "deployment_not_fully_available",
    "arguments": {
      "name": ""
    }
  }
}
name: deployment-not-fully-available
provider:
  arguments:
    name: ''
  func: deployment_not_fully_available
  module: chaosk8s.deployment.probes
  type: python
type: probe

deployment_partially_available

Type probe
Module chaosk8s.deployment.probes
Name deployment_partially_available
Return Optional[bool]

Check whether if the given deployment state is ready or at-least partially ready. Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected. Unless raise_on_not_partially_available is set to False which means the probe will return False rather than raise the exception.

Signature:

def deployment_partially_available(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        raise_on_not_partially_available: bool = True,
        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
raise_on_not_partially_available boolean true No

Usage:

{
  "name": "deployment-partially-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.deployment.probes",
    "func": "deployment_partially_available",
    "arguments": {
      "name": ""
    }
  }
}
name: deployment-partially-available
provider:
  arguments:
    name: ''
  func: deployment_partially_available
  module: chaosk8s.deployment.probes
  type: python
type: probe

rollout_deployment

Type action
Module chaosk8s.deployment.actions
Name rollout_deployment
Return None

Rolling the deployment. The name is the name of the deployment.

Signature:

def rollout_deployment(name: str = None,
                       ns: str = 'default',
                       secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string null No
ns string “default” No

Usage:

{
  "name": "rollout-deployment",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.deployment.actions",
    "func": "rollout_deployment"
  }
}
name: rollout-deployment
provider:
  func: rollout_deployment
  module: chaosk8s.deployment.actions
  type: python
type: action

scale_deployment

Type action
Module chaosk8s.deployment.actions
Name scale_deployment
Return None

Scale a deployment up or down. The name is the name of the deployment.

Signature:

def scale_deployment(name: str,
                     replicas: int,
                     ns: str = 'default',
                     secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
replicas integer Yes
ns string “default” No

Usage:

{
  "name": "scale-deployment",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.deployment.actions",
    "func": "scale_deployment",
    "arguments": {
      "name": "",
      "replicas": 0
    }
  }
}
name: scale-deployment
provider:
  arguments:
    name: ''
    replicas: 0
  func: scale_deployment
  module: chaosk8s.deployment.actions
  type: python
type: action

event


get_events

Type probe
Module chaosk8s.event.probes
Name get_events
Return mapping

Retrieve Kubernetes events across all namespaces. If a label_selector is set, filter to that selector only.

The right values for field_selector come from https://github.com/kubernetes/kubernetes/blob/d1a2a134c532109540025c990697a6900c2e62fc/pkg/apis/events/v1/conversion.go#L66

Signature:

def get_events(label_selector: str = None,
               field_selector: str = None,
               limit: int = 100,
               configuration: Dict[str, Dict[str, str]] = None,
               secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
label_selector string null No
field_selector string null No
limit integer 100 No

Usage:

{
  "name": "get-events",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.event.probes",
    "func": "get_events"
  }
}
name: get-events
provider:
  func: get_events
  module: chaosk8s.event.probes
  type: python
type: probe

namespace


create_namespace

Type action
Module chaosk8s.namespace.actions
Name create_namespace
Return None

Create a namespace from the specified spec_path, which must be the path to the JSON or YAML representation of the namespace.

Signature:

def create_namespace(name: str = None,
                     spec_path: str = None,
                     secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string null No
spec_path string null No

Usage:

{
  "name": "create-namespace",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.namespace.actions",
    "func": "create_namespace"
  }
}
name: create-namespace
provider:
  func: create_namespace
  module: chaosk8s.namespace.actions
  type: python
type: action

delete_namespace

Type action
Module chaosk8s.namespace.actions
Name delete_namespace
Return None

Remove the given namespace

Signature:

def delete_namespace(name: str, secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes

Usage:

{
  "name": "delete-namespace",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.namespace.actions",
    "func": "delete_namespace",
    "arguments": {
      "name": ""
    }
  }
}
name: delete-namespace
provider:
  arguments:
    name: ''
  func: delete_namespace
  module: chaosk8s.namespace.actions
  type: python
type: action

namespace_exists

Type probe
Module chaosk8s.namespace.probes
Name namespace_exists
Return boolean

Lookup a namespace by its name and returns False when the namespace was not found.

Signature:

def namespace_exists(name: str,
                     secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes

Usage:

{
  "name": "namespace-exists",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.namespace.probes",
    "func": "namespace_exists",
    "arguments": {
      "name": ""
    }
  }
}
name: namespace-exists
provider:
  arguments:
    name: ''
  func: namespace_exists
  module: chaosk8s.namespace.probes
  type: python
type: probe

networking


allow_dns_access

Type action
Module chaosk8s.networking.actions
Name allow_dns_access
Return None

Convenient helper rule to DNS access from all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def allow_dns_access(label_selectors: Dict[str, Any] = None,
                     ns: str = 'default',
                     secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
label_selectors mapping null No
ns string “default” No

Usage:

{
  "name": "allow-dns-access",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "allow_dns_access"
  }
}
name: allow-dns-access
provider:
  func: allow_dns_access
  module: chaosk8s.networking.actions
  type: python
type: action

create_ingress

Type action
Module chaosk8s.networking.actions
Name create_ingress
Return None

Create an ingress object from the specified spec_path, which must be the path to the JSON or YAML representation of the ingress.

Signature:

def create_ingress(spec_path: str,
                   ns: str = 'default',
                   secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
spec_path string Yes
ns string “default” No

Usage:

{
  "name": "create-ingress",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "create_ingress",
    "arguments": {
      "spec_path": ""
    }
  }
}
name: create-ingress
provider:
  arguments:
    spec_path: ''
  func: create_ingress
  module: chaosk8s.networking.actions
  type: python
type: action

create_network_policy

Type action
Module chaosk8s.networking.actions
Name create_network_policy
Return None

Create a network policy in the given namespace eitehr from the definition as spec or from a file containing the definition at spec_path.

Signature:

def create_network_policy(spec: Dict[str, Any] = None,
                          spec_path: str = None,
                          ns: str = 'default',
                          secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
spec mapping null No
spec_path string null No
ns string “default” No

Usage:

{
  "name": "create-network-policy",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "create_network_policy"
  }
}
name: create-network-policy
provider:
  func: create_network_policy
  module: chaosk8s.networking.actions
  type: python
type: action

delete_ingress

Type action
Module chaosk8s.networking.actions
Name delete_ingress
Return None

Remove the given ingress

Signature:

def delete_ingress(name: str,
                   ns: str = 'default',
                   secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "delete-ingress",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "delete_ingress",
    "arguments": {
      "name": ""
    }
  }
}
name: delete-ingress
provider:
  arguments:
    name: ''
  func: delete_ingress
  module: chaosk8s.networking.actions
  type: python
type: action

deny_all_egress

Type action
Module chaosk8s.networking.actions
Name deny_all_egress
Return None

Convenient helper rule to deny all egress network from all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def deny_all_egress(label_selectors: Dict[str, Any] = None,
                    ns: str = 'default',
                    secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
label_selectors mapping null No
ns string “default” No

Usage:

{
  "name": "deny-all-egress",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "deny_all_egress"
  }
}
name: deny-all-egress
provider:
  func: deny_all_egress
  module: chaosk8s.networking.actions
  type: python
type: action

deny_all_ingress

Type action
Module chaosk8s.networking.actions
Name deny_all_ingress
Return None

Convenient helper policy to deny ingress network to all pods in a namespace, unless `label_selectors, in which case, only matching pods will be impacted.

Signature:

def deny_all_ingress(label_selectors: Dict[str, Any] = None,
                     ns: str = 'default',
                     secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
label_selectors mapping null No
ns string “default” No

Usage:

{
  "name": "deny-all-ingress",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "deny_all_ingress"
  }
}
name: deny-all-ingress
provider:
  func: deny_all_ingress
  module: chaosk8s.networking.actions
  type: python
type: action

ingress_exists

Type probe
Module chaosk8s.networking.probes
Name ingress_exists
Return boolean

Lookup a ingress by its name and returns False when the ingress was not found.

Signature:

def ingress_exists(name: str,
                   ns: str = 'default',
                   secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "ingress-exists",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.probes",
    "func": "ingress_exists",
    "arguments": {
      "name": ""
    }
  }
}
name: ingress-exists
provider:
  arguments:
    name: ''
  func: ingress_exists
  module: chaosk8s.networking.probes
  type: python
type: probe

remove_allow_dns_access

Type action
Module chaosk8s.networking.actions
Name remove_allow_dns_access
Return None

Remove the rule set by the allow_dns_access action.

Signature:

def remove_allow_dns_access(ns: str = 'default',
                            secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
ns string “default” No

Usage:

{
  "name": "remove-allow-dns-access",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "remove_allow_dns_access"
  }
}
name: remove-allow-dns-access
provider:
  func: remove_allow_dns_access
  module: chaosk8s.networking.actions
  type: python
type: action

remove_deny_all_egress

Type action
Module chaosk8s.networking.actions
Name remove_deny_all_egress
Return None

Remove the rule set by the deny_all_egress action.

Signature:

def remove_deny_all_egress(ns: str = 'default',
                           secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
ns string “default” No

Usage:

{
  "name": "remove-deny-all-egress",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "remove_deny_all_egress"
  }
}
name: remove-deny-all-egress
provider:
  func: remove_deny_all_egress
  module: chaosk8s.networking.actions
  type: python
type: action

remove_deny_all_ingress

Type action
Module chaosk8s.networking.actions
Name remove_deny_all_ingress
Return None

Remove the rule set by the deny_all_ingress action.

Signature:

def remove_deny_all_ingress(ns: str = 'default',
                            secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
ns string “default” No

Usage:

{
  "name": "remove-deny-all-ingress",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "remove_deny_all_ingress"
  }
}
name: remove-deny-all-ingress
provider:
  func: remove_deny_all_ingress
  module: chaosk8s.networking.actions
  type: python
type: action

remove_network_policy

Type action
Module chaosk8s.networking.actions
Name remove_network_policy
Return None

Create a network policy in the given namespace eitehr from the definition as spec or from a file containing the definition at spec_path.

Signature:

def remove_network_policy(name: str,
                          ns: str = 'default',
                          secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "remove-network-policy",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "remove_network_policy",
    "arguments": {
      "name": ""
    }
  }
}
name: remove-network-policy
provider:
  arguments:
    name: ''
  func: remove_network_policy
  module: chaosk8s.networking.actions
  type: python
type: action

update_ingress

Type action
Module chaosk8s.networking.actions
Name update_ingress
Return None

Update the specification of the targeted ingress according to spec.

Signature:

def update_ingress(name: str,
                   spec: dict,
                   ns: str = 'default',
                   secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
spec mapping Yes
ns string “default” No

Usage:

{
  "name": "update-ingress",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.networking.actions",
    "func": "update_ingress",
    "arguments": {
      "name": "",
      "spec": {}
    }
  }
}
name: update-ingress
provider:
  arguments:
    name: ''
    spec: {}
  func: update_ingress
  module: chaosk8s.networking.actions
  type: python
type: action

node


all_nodes_must_be_ready_to_schedule

Type probe
Module chaosk8s.node.probes
Name all_nodes_must_be_ready_to_schedule
Return boolean

Verifies that all nodes in the cluster are in Ready condition and can be scheduled. You can select a subset of nodes by specifying a label_selector.

Signature:

def all_nodes_must_be_ready_to_schedule(
        label_selector: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
label_selector string null No

Usage:

{
  "name": "all-nodes-must-be-ready-to-schedule",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.probes",
    "func": "all_nodes_must_be_ready_to_schedule"
  }
}
name: all-nodes-must-be-ready-to-schedule
provider:
  func: all_nodes_must_be_ready_to_schedule
  module: chaosk8s.node.probes
  type: python
type: probe

cordon_node

Type action
Module chaosk8s.node.actions
Name cordon_node
Return list

Cordon nodes matching the given label or name, so that no pods are scheduled on them any longer.

Signature:

def cordon_node(name: str = None,
                label_selector: str = None,
                secrets: Dict[str, Dict[str, str]] = None) -> List[str]:
    pass

Arguments:

Name Type Default Required
name string null No
label_selector string null No

Usage:

{
  "name": "cordon-node",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.actions",
    "func": "cordon_node"
  }
}
name: cordon-node
provider:
  func: cordon_node
  module: chaosk8s.node.actions
  type: python
type: action

create_node

Type action
Module chaosk8s.node.actions
Name create_node
Return kubernetes.client.models.v1_node.V1Node

Create one new node in the cluster.

Due to the way things work on certain cloud providers, you won’t be able to use this meaningfully on them. For instance on GCE, this will likely fail.

See also: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#idempotency

Signature:

def create_node(
    meta: Dict[str, Any] = None,
    spec: Dict[str, Any] = None,
    secrets: Dict[str, Dict[str, str]] = None
) -> kubernetes.client.models.v1_node.V1Node:
    pass

Arguments:

Name Type Default Required
meta mapping null No
spec mapping null No

Usage:

{
  "name": "create-node",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.actions",
    "func": "create_node"
  }
}
name: create-node
provider:
  func: create_node
  module: chaosk8s.node.actions
  type: python
type: action

delete_nodes

Type action
Module chaosk8s.node.actions
Name delete_nodes
Return list

Delete nodes gracefully. Select the appropriate nodes by label.

Nodes are not drained beforehand so we can see how cluster behaves. Nodes cannot be restarted, they are really deleted. Please be careful when using this action.

On certain cloud providers, you also need to delete the underneath VM instance as well afterwards. This is the case on GCE for instance.

If all is set to True, all nodes will be terminated. If rand is set to True, one random node will be terminated. If ̀count is set to a positive number, only a upto count nodes (randomly picked) will be terminated. Otherwise, the first retrieved node will be terminated.

Signature:

def delete_nodes(label_selector: str = None,
                 all: bool = False,
                 rand: bool = False,
                 count: int = None,
                 grace_period_seconds: int = None,
                 secrets: Dict[str, Dict[str, str]] = None,
                 pod_label_selector: str = None,
                 pod_namespace: str = None) -> List[str]:
    pass

Arguments:

Name Type Default Required
label_selector string null No
all boolean false No
rand boolean false No
count integer null No
grace_period_seconds integer null No
pod_label_selector string null No
pod_namespace string null No

Usage:

{
  "name": "delete-nodes",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.actions",
    "func": "delete_nodes"
  }
}
name: delete-nodes
provider:
  func: delete_nodes
  module: chaosk8s.node.actions
  type: python
type: action

drain_nodes

Type action
Module chaosk8s.node.actions
Name drain_nodes
Return list

Drain nodes matching the given label or name, so that no pods are scheduled on them any longer and running pods are evicted.

It does a similar job to kubectl drain --ignore-daemonsets or kubectl drain --delete-local-data --ignore-daemonsets if delete_pods_with_local_storage is set to True. There is no equivalent to the kubectl drain --force flag.

You probably want to call uncordon from in your experiment’s rollbacks.

Signature:

def drain_nodes(name: str = None,
                label_selector: str = None,
                delete_pods_with_local_storage: bool = False,
                timeout: int = 120,
                secrets: Dict[str, Dict[str, str]] = None,
                count: int = None,
                pod_label_selector: str = None,
                pod_namespace: str = None) -> List[str]:
    pass

Arguments:

Name Type Default Required
name string null No
label_selector string null No
delete_pods_with_local_storage boolean false No
timeout integer 120 No
count integer null No
pod_label_selector string null No
pod_namespace string null No

Usage:

{
  "name": "drain-nodes",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.actions",
    "func": "drain_nodes"
  }
}
name: drain-nodes
provider:
  func: drain_nodes
  module: chaosk8s.node.actions
  type: python
type: action

get_all_node_status_conditions

Type probe
Module chaosk8s.node.probes
Name get_all_node_status_conditions
Return list

Get all nodes conditions. You can select a subset of nodes by specifying a label_selector.

Signature:

def get_all_node_status_conditions(
        label_selector: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, str]]:
    pass

Arguments:

Name Type Default Required
label_selector string null No

Usage:

{
  "name": "get-all-node-status-conditions",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.probes",
    "func": "get_all_node_status_conditions"
  }
}
name: get-all-node-status-conditions
provider:
  func: get_all_node_status_conditions
  module: chaosk8s.node.probes
  type: python
type: probe

get_nodes

Type probe
Module chaosk8s.node.probes
Name get_nodes
Return None

List all Kubernetes worker nodes in your cluster. You may filter nodes by specifying a label selector.

Signature:

def get_nodes(label_selector: str = None,
              configuration: Dict[str, Dict[str, str]] = None,
              secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
label_selector string null No

Usage:

{
  "name": "get-nodes",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.probes",
    "func": "get_nodes"
  }
}
name: get-nodes
provider:
  func: get_nodes
  module: chaosk8s.node.probes
  type: python
type: probe

nodes_must_be_healthy

Type probe
Module chaosk8s.node.probes
Name nodes_must_be_healthy
Return boolean

Verifies the state of the following node conditions:

  • FrequentKubeletRestart must be False
  • FrequentDockerRestart must be False
  • FrequentContainerdRestart must be False
  • ReadonlyFilesystem must be False
  • KernelDeadlock must be False
  • CorruptDockerOverlay2 must be False
  • FrequentUnregisterNetDevice must be False
  • NetworkUnavailable must be False
  • FrequentKubeletRestart must be False
  • MemoryPressure must be False
  • DiskPressure must be False
  • PIDPressure must be False
  • Ready must be True

For all matching nodes, if any is not in the expected state, returns False.

Signature:

def nodes_must_be_healthy(label_selector: str = None,
                          configuration: Dict[str, Dict[str, str]] = None,
                          secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
label_selector string null No

Usage:

{
  "name": "nodes-must-be-healthy",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.probes",
    "func": "nodes_must_be_healthy"
  }
}
name: nodes-must-be-healthy
provider:
  func: nodes_must_be_healthy
  module: chaosk8s.node.probes
  type: python
type: probe

uncordon_node

Type action
Module chaosk8s.node.actions
Name uncordon_node
Return list

Uncordon nodes matching the given label name, so that pods can be scheduled on them again.

Signature:

def uncordon_node(name: str = None,
                  label_selector: str = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> List[str]:
    pass

Arguments:

Name Type Default Required
name string null No
label_selector string null No

Usage:

{
  "name": "uncordon-node",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.actions",
    "func": "uncordon_node"
  }
}
name: uncordon-node
provider:
  func: uncordon_node
  module: chaosk8s.node.actions
  type: python
type: action

verify_nodes_condition

Type probe
Module chaosk8s.node.probes
Name verify_nodes_condition
Return boolean

For each select node, verifies that the gievn condition is met.

Signature:

def verify_nodes_condition(condition_type: str = 'PIDPressure',
                           condition_value: str = 'False',
                           label_selector: str = None,
                           configuration: Dict[str, Dict[str, str]] = None,
                           secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
condition_type string “PIDPressure” No
condition_value string “False” No
label_selector string null No

Usage:

{
  "name": "verify-nodes-condition",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.node.probes",
    "func": "verify_nodes_condition"
  }
}
name: verify-nodes-condition
provider:
  func: verify_nodes_condition
  module: chaosk8s.node.probes
  type: python
type: probe

pod


count_min_pods

Type probe
Module chaosk8s.pod.probes
Name count_min_pods
Return boolean

Check if minimum number of pods are running.

Signature:

def count_min_pods(label_selector: str,
                   phase: str = 'Running',
                   min_count: int = 2,
                   ns: str = 'default',
                   secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
label_selector string Yes
phase string “Running” No
min_count integer 2 No
ns string “default” No

Usage:

{
  "name": "count-min-pods",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "count_min_pods",
    "arguments": {
      "label_selector": ""
    }
  }
}
name: count-min-pods
provider:
  arguments:
    label_selector: ''
  func: count_min_pods
  module: chaosk8s.pod.probes
  type: python
type: probe

count_pods

Type probe
Module chaosk8s.pod.probes
Name count_pods
Return integer

Count the number of pods matching the given selector in a given phase, if one is given.

Signature:

def count_pods(label_selector: str,
               phase: str = None,
               ns: str = 'default',
               secrets: Dict[str, Dict[str, str]] = None) -> int:
    pass

Arguments:

Name Type Default Required
label_selector string Yes
phase string null No
ns string “default” No

Usage:

{
  "name": "count-pods",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "count_pods",
    "arguments": {
      "label_selector": ""
    }
  }
}
name: count-pods
provider:
  arguments:
    label_selector: ''
  func: count_pods
  module: chaosk8s.pod.probes
  type: python
type: probe

exec_in_pods

Type action
Module chaosk8s.pod.actions
Name exec_in_pods
Return list

Execute the command cmd in the specified pod’s container. Select the appropriate pods by label and/or name patterns. Whenever a pattern is provided for the name, all pods retrieved will be filtered out if their name do not match the given pattern.

If neither label_selector nor name_pattern are provided, all pods in the namespace will be selected to execute the command.

If all is set to True, all matching pods will be affected.

Value of qty varies based on mode. If mode is set to fixed, then qty refers to number of pods affected. If mode is set to percentage, then qty refers to percentage of pods, from 1 to 100, to be affected. Default mode is fixed and default qty is 1.

If order is set to oldest, the retrieved pods will be ordered by the pods creation_timestamp, with the oldest pod first in list.

If rand is set to True, n random pods will be affected Otherwise, the first retrieved n pods will be used

The cmd should be a string or a sequence of program arguments. Providing a sequence of arguments is generally preferred, as it allows the action to take care of any required escaping and quoting (e.g. to permit spaces in the arguments). If passing a single string it will be split automatically.

Signature:

def exec_in_pods(
        cmd: Union[str, List[str]],
        label_selector: str = None,
        name_pattern: str = None,
        all: bool = False,
        rand: bool = False,
        mode: str = 'fixed',
        qty: int = 1,
        ns: str = 'default',
        order: str = 'alphabetic',
        container_name: str = None,
        request_timeout: int = 60,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
cmd object Yes
label_selector string null No
name_pattern string null No
all boolean false No
rand boolean false No
mode string “fixed” No
qty integer 1 No
ns string “default” No
order string “alphabetic” No
container_name string null No
request_timeout integer 60 No

Usage:

{
  "name": "exec-in-pods",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.actions",
    "func": "exec_in_pods",
    "arguments": {
      "cmd": null
    }
  }
}
name: exec-in-pods
provider:
  arguments:
    cmd: null
  func: exec_in_pods
  module: chaosk8s.pod.actions
  type: python
type: action

pod_is_not_available

Type probe
Module chaosk8s.pod.probes
Name pod_is_not_available
Return boolean

Lookup pods with a name label set to the given name in the specified ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when one of the pods with the specified name is in the "Running" phase.

Signature:

def pod_is_not_available(name: str,
                         ns: str = 'default',
                         label_selector: str = 'name in ({name})',
                         raise_on_is_available: bool = True,
                         secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string “name in ({name})” No
raise_on_is_available boolean true No

Usage:

{
  "name": "pod-is-not-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "pod_is_not_available",
    "arguments": {
      "name": ""
    }
  }
}
name: pod-is-not-available
provider:
  arguments:
    name: ''
  func: pod_is_not_available
  module: chaosk8s.pod.probes
  type: python
type: probe

pods_in_conditions

Type probe
Module chaosk8s.pod.probes
Name pods_in_conditions
Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed if one of the given conditions type/status is not as expected unless raise_on_invalid_conditions. In that case, returns False.

Signature:

def pods_in_conditions(label_selector: str,
                       conditions: List[Dict[str, str]],
                       ns: str = 'default',
                       raise_on_invalid_conditions: bool = True,
                       secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
label_selector string Yes
conditions list Yes
ns string “default” No
raise_on_invalid_conditions boolean true No

Usage:

{
  "name": "pods-in-conditions",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "pods_in_conditions",
    "arguments": {
      "label_selector": "",
      "conditions": []
    }
  }
}
name: pods-in-conditions
provider:
  arguments:
    conditions: []
    label_selector: ''
  func: pods_in_conditions
  module: chaosk8s.pod.probes
  type: python
type: probe

pods_in_phase

Type probe
Module chaosk8s.pod.probes
Name pods_in_phase
Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when the state is not as expected unless raise_on_invalid_phase. In that case, returns False.

Signature:

def pods_in_phase(label_selector: str,
                  phase: str = 'Running',
                  ns: str = 'default',
                  raise_on_invalid_phase: bool = True,
                  secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
label_selector string Yes
phase string “Running” No
ns string “default” No
raise_on_invalid_phase boolean true No

Usage:

{
  "name": "pods-in-phase",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "pods_in_phase",
    "arguments": {
      "label_selector": ""
    }
  }
}
name: pods-in-phase
provider:
  arguments:
    label_selector: ''
  func: pods_in_phase
  module: chaosk8s.pod.probes
  type: python
type: probe

pods_not_in_phase

Type probe
Module chaosk8s.pod.probes
Name pods_not_in_phase
Return boolean

Lookup a pod by label_selector in the namespace ns.

Raises :exc:chaoslib.exceptions.ActivityFailed when the pod is in the given phase and should not have, unless raise_on_in_phase. In that case, returns False.

Signature:

def pods_not_in_phase(label_selector: str,
                      phase: str = 'Running',
                      ns: str = 'default',
                      raise_on_in_phase: bool = True,
                      secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
label_selector string Yes
phase string “Running” No
ns string “default” No
raise_on_in_phase boolean true No

Usage:

{
  "name": "pods-not-in-phase",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "pods_not_in_phase",
    "arguments": {
      "label_selector": ""
    }
  }
}
name: pods-not-in-phase
provider:
  arguments:
    label_selector: ''
  func: pods_not_in_phase
  module: chaosk8s.pod.probes
  type: python
type: probe

read_pod_logs

Type probe
Module chaosk8s.pod.probes
Name read_pod_logs
Return mapping

Fetch logs for all the pods with the label "name" set to name and return a dictionary with the keys being the pod’s name and the values the logs of said pod. If name is not provided, use only the label_selector instead.

When your pod has several containers, you should also set container_name to clarify which container you want to read logs from.

If you provide last, this returns the logs of the last N seconds until now. This can set to a fluent delta such as 10 minutes.

You may also set from_previous to True to capture the logs of a previous pod’s incarnation, if any.

Signature:

def read_pod_logs(name: str = None,
                  last: Optional[str] = None,
                  ns: str = 'default',
                  from_previous: bool = False,
                  label_selector: str = 'name in ({name})',
                  container_name: str = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, str]:
    pass

Arguments:

Name Type Default Required
name string null No
last object null No
ns string “default” No
from_previous boolean false No
label_selector string “name in ({name})” No
container_name string null No

Usage:

{
  "name": "read-pod-logs",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "read_pod_logs"
  }
}
name: read-pod-logs
provider:
  func: read_pod_logs
  module: chaosk8s.pod.probes
  type: python
type: probe

should_be_found_in_logs

Type probe
Module chaosk8s.pod.probes
Name should_be_found_in_logs
Return boolean

Lookup for the first occurence of pattern in the logs of each container fetched by the read_pod_logs probe.

If all_containers is set the match must occur on all continers. Otherwise, allow for only a subset of containers to match the search.

Signature:

def should_be_found_in_logs(pattern: str,
                            all_containers: bool = True,
                            value: Dict[str, str] = None,
                            secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
pattern string Yes
all_containers boolean true No
value mapping null No

Usage:

{
  "name": "should-be-found-in-logs",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.probes",
    "func": "should_be_found_in_logs",
    "arguments": {
      "pattern": ""
    }
  }
}
name: should-be-found-in-logs
provider:
  arguments:
    pattern: ''
  func: should_be_found_in_logs
  module: chaosk8s.pod.probes
  type: python
type: probe

terminate_pods

Type action
Module chaosk8s.pod.actions
Name terminate_pods
Return None

Terminate a pod gracefully. Select the appropriate pods by label and/or name patterns. Whenever a pattern is provided for the name, all pods retrieved will be filtered out if their name do not match the given pattern.

If neither label_selector nor name_pattern are provided, all pods in the namespace will be selected for termination.

If all is set to True, all matching pods will be terminated.

Value of qty varies based on mode. If mode is set to fixed, then qty refers to number of pods to be terminated. If mode is set to percentage, then qty refers to percentage of pods, from 1 to 100, to be terminated. Default mode is fixed and default qty is 1.

If order is set to oldest, the retrieved pods will be ordered by the pods creation_timestamp, with the oldest pod first in list.

If rand is set to True, n random pods will be terminated Otherwise, the first retrieved n pods will be terminated.

If grace_period is greater than or equal to 0, it will be used as the grace period (in seconds) to terminate the pods. Otherwise, the default pod’s grace period will be used.

Signature:

def terminate_pods(label_selector: str = None,
                   name_pattern: str = None,
                   all: bool = False,
                   rand: bool = False,
                   mode: str = 'fixed',
                   qty: int = 1,
                   grace_period: int = -1,
                   ns: str = 'default',
                   order: str = 'alphabetic',
                   secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
label_selector string null No
name_pattern string null No
all boolean false No
rand boolean false No
mode string “fixed” No
qty integer 1 No
grace_period integer -1 No
ns string “default” No
order string “alphabetic” No

Usage:

{
  "name": "terminate-pods",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.pod.actions",
    "func": "terminate_pods"
  }
}
name: terminate-pods
provider:
  func: terminate_pods
  module: chaosk8s.pod.actions
  type: python
type: action

probes


all_microservices_healthy

Type probe
Module chaosk8s.probes
Name all_microservices_healthy
Return Tuple[Dict[str, Any], Dict[str, Any]]

!!!DEPRECATED!!!

Signature:

def all_microservices_healthy(
    ns: str = 'default',
    secrets: Dict[str, Dict[str, str]] = None
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
ns string “default” No

Usage:

{
  "name": "all-microservices-healthy",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.probes",
    "func": "all_microservices_healthy"
  }
}
name: all-microservices-healthy
provider:
  func: all_microservices_healthy
  module: chaosk8s.probes
  type: python
type: probe

deployment_is_fully_available

Type probe
Module chaosk8s.probes
Name deployment_is_fully_available
Return None

!!!DEPRECATED!!!

Signature:

def deployment_is_fully_available(name: str,
                                  ns: str = 'default',
                                  label_selector: str = None,
                                  timeout: int = 30,
                                  secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
timeout integer 30 No

Usage:

{
  "name": "deployment-is-fully-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.probes",
    "func": "deployment_is_fully_available",
    "arguments": {
      "name": ""
    }
  }
}
name: deployment-is-fully-available
provider:
  arguments:
    name: ''
  func: deployment_is_fully_available
  module: chaosk8s.probes
  type: python
type: probe

deployment_is_not_fully_available

Type probe
Module chaosk8s.probes
Name deployment_is_not_fully_available
Return None

!!!DEPRECATED!!!

Signature:

def deployment_is_not_fully_available(name: str,
                                      ns: str = 'default',
                                      label_selector: str = None,
                                      timeout: int = 30,
                                      secrets: Dict[str, Dict[str,
                                                              str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
timeout integer 30 No

Usage:

{
  "name": "deployment-is-not-fully-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.probes",
    "func": "deployment_is_not_fully_available",
    "arguments": {
      "name": ""
    }
  }
}
name: deployment-is-not-fully-available
provider:
  arguments:
    name: ''
  func: deployment_is_not_fully_available
  module: chaosk8s.probes
  type: python
type: probe

microservice_available_and_healthy

Type probe
Module chaosk8s.probes
Name microservice_available_and_healthy
Return Optional[bool]

!!!DEPRECATED!!!

Signature:

def microservice_available_and_healthy(
        name: str,
        ns: str = 'default',
        label_selector: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Optional[bool]:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No

Usage:

{
  "name": "microservice-available-and-healthy",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.probes",
    "func": "microservice_available_and_healthy",
    "arguments": {
      "name": ""
    }
  }
}
name: microservice-available-and-healthy
provider:
  arguments:
    name: ''
  func: microservice_available_and_healthy
  module: chaosk8s.probes
  type: python
type: probe

microservice_is_not_available

Type probe
Module chaosk8s.probes
Name microservice_is_not_available
Return boolean

!!!DEPRECATED!!!

Signature:

def microservice_is_not_available(
        name: str,
        ns: str = 'default',
        label_selector: str = 'name in ({name})',
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string “name in ({name})” No

Usage:

{
  "name": "microservice-is-not-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.probes",
    "func": "microservice_is_not_available",
    "arguments": {
      "name": ""
    }
  }
}
name: microservice-is-not-available
provider:
  arguments:
    name: ''
  func: microservice_is_not_available
  module: chaosk8s.probes
  type: python
type: probe

read_microservices_logs

Type probe
Module chaosk8s.probes
Name read_microservices_logs
Return mapping

Fetch logs for all the pods with the label "name" set to name and return a dictionary with the keys being the pod’s name and the values the logs of said pod. If name is not provided, use only the label_selector instead.

When your pod has several containers, you should also set container_name to clarify which container you want to read logs from.

If you provide last, this returns the logs of the last N seconds until now. This can set to a fluent delta such as 10 minutes.

You may also set from_previous to True to capture the logs of a previous pod’s incarnation, if any.

Signature:

def read_microservices_logs(
        name: str = None,
        last: Optional[str] = None,
        ns: str = 'default',
        from_previous: bool = False,
        label_selector: str = 'name in ({name})',
        container_name: str = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, str]:
    pass

Arguments:

Name Type Default Required
name string null No
last object null No
ns string “default” No
from_previous boolean false No
label_selector string “name in ({name})” No
container_name string null No

Usage:

{
  "name": "read-microservices-logs",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.probes",
    "func": "read_microservices_logs"
  }
}
name: read-microservices-logs
provider:
  func: read_microservices_logs
  module: chaosk8s.probes
  type: python
type: probe

secret_exists

Type probe
Module chaosk8s.probes
Name secret_exists
Return boolean

Lookup a secret by its name and returns False when the secret was not found.

Signature:

def secret_exists(name: str = None,
                  ns: str = 'default',
                  label_selector: str = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string null No
ns string “default” No
label_selector string null No

Usage:

{
  "name": "secret-exists",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.probes",
    "func": "secret_exists"
  }
}
name: secret-exists
provider:
  func: secret_exists
  module: chaosk8s.probes
  type: python
type: probe

service_endpoint_is_initialized

Type probe
Module chaosk8s.probes
Name service_endpoint_is_initialized
Return None

!!!DEPRECATED!!!

Signature:

def service_endpoint_is_initialized(name: str,
                                    ns: str = 'default',
                                    label_selector: str = 'name in ({name})',
                                    secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string “name in ({name})” No

Usage:

{
  "name": "service-endpoint-is-initialized",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.probes",
    "func": "service_endpoint_is_initialized",
    "arguments": {
      "name": ""
    }
  }
}
name: service-endpoint-is-initialized
provider:
  arguments:
    name: ''
  func: service_endpoint_is_initialized
  module: chaosk8s.probes
  type: python
type: probe

replicaset


delete_replica_set

Type action
Module chaosk8s.replicaset.actions
Name delete_replica_set
Return None

Delete a replica set by name or label_selector in the namespace ns.

The replica set is deleted without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the replica sets will be deleted in the namespace.

Signature:

def delete_replica_set(name: str = None,
                       ns: str = 'default',
                       label_selector: str = None,
                       secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string null No
ns string “default” No
label_selector string null No

Usage:

{
  "name": "delete-replica-set",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.replicaset.actions",
    "func": "delete_replica_set"
  }
}
name: delete-replica-set
provider:
  func: delete_replica_set
  module: chaosk8s.replicaset.actions
  type: python
type: action

secret


create_secret

Type action
Module chaosk8s.secret.actions
Name create_secret
Return None

Create a secret endpoint described by the secret config, which must be the path to the JSON or YAML representation of the secret.

Signature:

def create_secret(spec_path: str,
                  ns: str = 'default',
                  secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
spec_path string Yes
ns string “default” No

Usage:

{
  "name": "create-secret",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.secret.actions",
    "func": "create_secret",
    "arguments": {
      "spec_path": ""
    }
  }
}
name: create-secret
provider:
  arguments:
    spec_path: ''
  func: create_secret
  module: chaosk8s.secret.actions
  type: python
type: action

delete_secret

Type action
Module chaosk8s.secret.actions
Name delete_secret
Return None

Remove the given secret

Signature:

def delete_secret(name: str,
                  ns: str = 'default',
                  secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "delete-secret",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.secret.actions",
    "func": "delete_secret",
    "arguments": {
      "name": ""
    }
  }
}
name: delete-secret
provider:
  arguments:
    name: ''
  func: delete_secret
  module: chaosk8s.secret.actions
  type: python
type: action

secret_exists

Type probe
Module chaosk8s.secret.probes
Name secret_exists
Return boolean

Lookup a secret by its name and returns False when the secret was not found.

Signature:

def secret_exists(name: str = None,
                  ns: str = 'default',
                  label_selector: str = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string null No
ns string “default” No
label_selector string null No

Usage:

{
  "name": "secret-exists",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.secret.probes",
    "func": "secret_exists"
  }
}
name: secret-exists
provider:
  func: secret_exists
  module: chaosk8s.secret.probes
  type: python
type: probe

service


create_service_endpoint

Type action
Module chaosk8s.service.actions
Name create_service_endpoint
Return None

Create a service endpoint described by the service config, which must be the path to the JSON or YAML representation of the service.

Signature:

def create_service_endpoint(spec_path: str,
                            ns: str = 'default',
                            secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
spec_path string Yes
ns string “default” No

Usage:

{
  "name": "create-service-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.service.actions",
    "func": "create_service_endpoint",
    "arguments": {
      "spec_path": ""
    }
  }
}
name: create-service-endpoint
provider:
  arguments:
    spec_path: ''
  func: create_service_endpoint
  module: chaosk8s.service.actions
  type: python
type: action

delete_service

Type action
Module chaosk8s.service.actions
Name delete_service
Return None

Remove the given service

Signature:

def delete_service(name: str,
                   ns: str = 'default',
                   secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No

Usage:

{
  "name": "delete-service",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.service.actions",
    "func": "delete_service",
    "arguments": {
      "name": ""
    }
  }
}
name: delete-service
provider:
  arguments:
    name: ''
  func: delete_service
  module: chaosk8s.service.actions
  type: python
type: action

service_is_initialized

Type probe
Module chaosk8s.service.probes
Name service_is_initialized
Return boolean

Lookup a service endpoint by its name and raises :exc:FailedProbe when the service was not found or not initialized.

If raise_if_service_not_initialized is set to False return False when probe isn’t as expected. Otherwise raises chaoslib.exceptions.ActivityFailed

Signature:

def service_is_initialized(name: str = None,
                           ns: str = 'default',
                           label_selector: str = None,
                           raise_if_service_not_initialized: bool = True,
                           secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string null No
ns string “default” No
label_selector string null No
raise_if_service_not_initialized boolean true No

Usage:

{
  "name": "service-is-initialized",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.service.probes",
    "func": "service_is_initialized"
  }
}
name: service-is-initialized
provider:
  func: service_is_initialized
  module: chaosk8s.service.probes
  type: python
type: probe

statefulset


create_statefulset

Type action
Module chaosk8s.statefulset.actions
Name create_statefulset
Return None

Create a statefulset described by the service config, which must be the path to the JSON or YAML representation of the statefulset.

Signature:

def create_statefulset(spec_path: str,
                       ns: str = 'default',
                       secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
spec_path string Yes
ns string “default” No

Usage:

{
  "name": "create-statefulset",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.statefulset.actions",
    "func": "create_statefulset",
    "arguments": {
      "spec_path": ""
    }
  }
}
name: create-statefulset
provider:
  arguments:
    spec_path: ''
  func: create_statefulset
  module: chaosk8s.statefulset.actions
  type: python
type: action

remove_statefulset

Type action
Module chaosk8s.statefulset.actions
Name remove_statefulset
Return None

Remove a statefulset by name or label_selector in the namespace ns.

The statefulset is removed by deleting it without a graceful period to trigger an abrupt termination.

If neither name nor label_selector is specified, all the statefulsets will be deleted in the namespace.

Signature:

def remove_statefulset(name: str = None,
                       ns: str = 'default',
                       label_selector: str = None,
                       secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string null No
ns string “default” No
label_selector string null No

Usage:

{
  "name": "remove-statefulset",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.statefulset.actions",
    "func": "remove_statefulset"
  }
}
name: remove-statefulset
provider:
  func: remove_statefulset
  module: chaosk8s.statefulset.actions
  type: python
type: action

scale_statefulset

Type action
Module chaosk8s.statefulset.actions
Name scale_statefulset
Return None

Scale a stateful set up or down. The name is the name of the stateful set.

Signature:

def scale_statefulset(name: str,
                      replicas: int,
                      ns: str = 'default',
                      secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
replicas integer Yes
ns string “default” No

Usage:

{
  "name": "scale-statefulset",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosk8s.statefulset.actions",
    "func": "scale_statefulset",
    "arguments": {
      "name": "",
      "replicas": 0
    }
  }
}
name: scale-statefulset
provider:
  arguments:
    name: ''
    replicas: 0
  func: scale_statefulset
  module: chaosk8s.statefulset.actions
  type: python
type: action

statefulset_fully_available

Type probe
Module chaosk8s.statefulset.probes
Name statefulset_fully_available
Return None

Wait until all the statefulSet expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_not_fully_available is set to False, return False instead of raising the exception.

Signature:

def statefulset_fully_available(name: str,
                                ns: str = 'default',
                                label_selector: str = None,
                                timeout: int = 30,
                                raise_on_not_fully_available: bool = True,
                                secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
timeout integer 30 No
raise_on_not_fully_available boolean true No

Usage:

{
  "name": "statefulset-fully-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.statefulset.probes",
    "func": "statefulset_fully_available",
    "arguments": {
      "name": ""
    }
  }
}
name: statefulset-fully-available
provider:
  arguments:
    name: ''
  func: statefulset_fully_available
  module: chaosk8s.statefulset.probes
  type: python
type: probe

statefulset_not_fully_available

Type probe
Module chaosk8s.statefulset.probes
Name statefulset_not_fully_available
Return None

Wait until the statefulSet gets into an intermediate state where not all expected replicas are available. Once this state is reached, return True. If the state is not reached after timeout seconds, a :exc:chaoslib.exceptions.ActivityFailed exception is raised.

If raise_on_fully_available is set to False, return False instead of raising the exception.

Signature:

def statefulset_not_fully_available(name: str,
                                    ns: str = 'default',
                                    label_selector: str = None,
                                    timeout: int = 30,
                                    raise_on_fully_available: bool = True,
                                    secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
ns string “default” No
label_selector string null No
timeout integer 30 No
raise_on_fully_available boolean true No

Usage:

{
  "name": "statefulset-not-fully-available",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosk8s.statefulset.probes",
    "func": "statefulset_not_fully_available",
    "arguments": {
      "name": ""
    }
  }
}
name: statefulset-not-fully-available
provider:
  arguments:
    name: ''
  func: statefulset_not_fully_available
  module: chaosk8s.statefulset.probes
  type: python
type: probe