Giter Site home page Giter Site logo

pod-chaos-monkey's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Pod Chaos Monkey

An awesome challenge to play with chaos engineering on k8s clusters!
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. License
  6. Contact

About The Project

This project provides:

  • a script (chaos-monkey-script.sh) which will be added on a Dockerfile that will be responsible for killing pods.
  • a Dockerfile to build an image to run inside a kubernetes cluster.
  • a job manifest to deploy the image created as the "chaos owner" in a specific namespace (Ex:"workloads")
  • a deployment manifest as the "chaos test target" in a specific namespace "workloads" to test the job

(back to top)

Getting Started

Here is where all the information to get this running and understand this challenge will be presented.

Prerequisites

  • Kubernetes cluster up and running.

Here is some options to get you started: [Local kubernetes cluster] https://docs.docker.com/get-docker/ (Enable Kubernetes feature) [Local kubernetes cluster] https://minikube.sigs.k8s.io/docs/start/ [Online kubernetes cluster] https://killercoda.com/kubernetes/scenario/a-playground

Usage

  1. Create a docker image
     docker build . -t chaos-monkey:0.0.1
  2. Deploy the "chaos test target"
    kubectl apply -f k8s/target-deployment.yaml
  3. Deploy the "chaos owner" and all dependencies
     kubectl apply -f k8s/chaos-monkey.yaml

(back to top)

Example

Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.

  1. Create a docker image alt text

[Extra] Scan image to check vulnerabilities. I used the Snyk plugin that Docker Desktop provided. alt text

  1. Deploy the "chaos test target". This deployment manifest has a specific label chaosmonkeytarget: "yes" as a security strategy to know which pods are available to be a target for our "chaos-monkey". alt text

  2. Deploy the "chaos owner" and all dependencies In this manifest we have all dependencies to provide our chaos-monkey permitions to kill some pods:

  • Create a namespace where our chaos-monkey will "live" -> chaosmonkey
  • Create a ServiceAccount (monkey-kill) to chaosmonkey use with specfic permissions.
  • Create a ClusterRole (modify-pods) to give permitions of get, list, delete and watch for only resources of type "pod".
  • Create a RoleBinding (modify-pods-monkeykill-sa) to give permitions to the ServiceAccount monkey-kill be able to use the ClusterRole modify-pods in "workloads" namespace only.
  • Create a job to run a chaosmonkey pod that will delete some pods with spefic arguments:
    • "NAMESPACE": Here we can specify a specific namespace.
    • "NR_POD_TO_KILL": Here we can choose how many pods we want to kill.
    • "TIME_INTERVAL" : Here we chan choose the time interval between each kill.

Chaosmonkey job alt text

Chaosmonkey in action with k8s events alt text

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

André Ribeiro - @My Linkedin

Project Link: https://github.com/andregribeiro/pod-chaos-monkey/

(back to top)

pod-chaos-monkey's People

Contributors

andregribeiro avatar

Stargazers

Pedro Lourenço avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.