Skip to main content
# Chaos Toolkit Kubernetes Support

[![Build Status](https://travis-ci.org/chaostoolkit/chaostoolkit-kubernetes.svg?branch=master)](https://travis-ci.org/chaostoolkit/chaostoolkit-kubernetes)

This project contains activities, such as probes and actions, you can call from
your experiment through the Chaos Toolkit.

## Install

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

[chaostoolkit]: https://github.com/chaostoolkit/chaostoolkit

```
$ pip install chaostoolkit-kubernetes
```

## Usage

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

```json
{
"name": "all-our-microservices-should-be-healthy",
"provider": {
"type": "python",
"module": "chaosk8s.probes",
"func": "microservice_available_and_healthy",
"arguments": {
"name": "myapp",
"ns": "myns"
}
}
},
{
"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,
"ns": "default"
}
},
"pauses": {
"after": 5
}
}
```

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

Please explore the code to see existing probes and actions.

### Discovery

You may use the Chaos Toolkit to discover the capabilities of this extension:

```
$ chaos discover chaostoolkit-kubernetes --no-install
```

## Configuration

This extension to the Chaos Toolkit can use the Kubernetes configuration
found at the usual place in your HOME directory under `~/.kube/`. You can
also pass the credentials via secrets as follows:

```json
{
"secrets": {
"kubernetes": {
"KUBERNETES_HOST": "http://somehost",
"KUBERNETES_API_KEY": {
"type": "env",
"key": "SO%E_ENV_VAR"
}
}
}
}
```

Then in your probe or action:

```json
{
"name": "all-our-microservices-should-be-healthy",
"provider": {
"type": "python",
"module": "chaosk8s.probes",
"func": "microservice_available_and_healthy",
"secrets": ["kubernetes"],
"arguments": {
"name": "myapp",
"ns": "myns"
}
}
}
```

## Contribute

If you wish to contribute more functions to this package, you are more than
welcome to do so. Please fork this project, make your changes following the
usual [PEP 8][pep8] code style, add appropriate tests and submit a PR for
review.

[pep8]: https://pycodestyle.readthedocs.io/en/latest/

The Chaos Toolkit projects require all contributors must sign a
[Developer Certificate of Origin][dco] 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.

[dco]: https://github.com/probot/dco#how-it-works

Release files for chaostoolkit-kubernetes 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chaostoolkit-kubernetes 0.11.0
File Size Uploaded
chaostoolkit-kubernetes-0.11.0.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chaostoolkit-kubernetes 0.11.0
File Interpreter ABI Platform
chaostoolkit_kubernetes-0.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.9 kB

Release files / chaostoolkit-kubernetes-0.11.0.tar.gz

Download URL chaostoolkit-kubernetes-0.11.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3801951547bf22b928511492851aafd571386a1b61de6e1dd30425622348a86c
BLAKE2b-256 checksum
How to use checksums
ecac30953264bbd514272c3a1d64576344f1e002628409db510aaf55ec648bd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / chaostoolkit_kubernetes-0.11.0-py3-none-any.whl

Download URL chaostoolkit_kubernetes-0.11.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07f264a27745197ff695667d7240ef383b11011e4b15c458480720aa1d9fc85f
BLAKE2b-256 checksum
How to use checksums
fcca0c0ebf83a65c8b4a8bd5bda4fb27171c4c3ade7e3e2ca9d2a9ab5fb0607f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.38.2

2 release files

0.38.1

2 release files

0.38.0

1 release file

0.37.0

1 release file

0.36.0

1 release file

0.35.0

2 release files

0.34.1

2 release files

0.34.0

2 release files

0.33.0

2 release files

0.32.1

2 release files

0.32.0

2 release files

0.31.1

2 release files

0.31.0

2 release files

0.30.1

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.26.4

2 release files

0.26.3

2 release files

0.26.2

2 release files

0.26.1

2 release files

0.26.0

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.23.0

2 release files

0.22.0

2 release files

0.20.0

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.12.0

2 release files

This release

0.11.0 This release

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page