Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more forms of failure: execute command in containers #169

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

misgod-yy
Copy link

@misgod-yy misgod-yy commented Jan 9, 2020

Support for executing command in containers.
Users could design different kinds of failures by executing different commands.
Add monkey behavior in kube-monkey's config as follows:

[kubemonkey]
dry_run = true                           # Terminations are only logged
run_hour = 8                             # Run scheduling at 8am on weekdays
harm_type = "exec_pod"                   # Monkey's behavior is to execute command in containers. Default value is "delete_pod", which represents deleting pods
start_hour = 10                          # Don't schedule any pod deaths before 10am
end_hour = 16                            # Don't schedule any pod deaths after 4pm
blacklisted_namespaces = ["kube-system"] # Critical apps live here
time_zone = "America/New_York"           # Set tzdata timezone example. Note the field is time_zone not timezone

Add command and containter for executing commands as follows:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    kube-monkey/exec-cmd: echo hello
  labels:
    kube-monkey/enabled: enabled
    kube-monkey/identifier: canary
    kube-monkey/kill-mode: fixed
    kube-monkey/kill-value: "1"
    kube-monkey/mtbf: "1"
    kube-monkey/container-name: "main"
[... omitted ...]

Test in k8s cluster:
exec_cmd_pic

@misgod-yy misgod-yy changed the title support more forms of failure: execute command in containers Support more forms of failure: execute command in containers Jan 9, 2020
@misgod-yy misgod-yy requested a review from asobti February 5, 2020 14:14
@worldtiki
Copy link
Collaborator

This looks interesting but very inflexible.
With the suggested approach you can only run the same exact attack against all your victims.
It seems a bit odd to use annotations with the command, but it would be more flexible.

@misgod-yy
Copy link
Author

This looks interesting but very inflexible.
With the suggested approach you can only run the same exact attack against all your victims.
It seems a bit odd to use annotations with the command, but it would be more flexible.

Thx for the suggestion. I've recommit the annotation label for pod to run different commands in container. It could support more complicated attack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants