GithubHelp home page GithubHelp logo

isabella232 / kubernetes-chaos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from postmanlabs/kubernetes-chaos

0.0 0.0 0.0 7.02 MB

Building resilient APIs with chaos engineering

License: Apache License 2.0

Shell 2.38% Dockerfile 1.53% Java 3.17% C# 48.72% Batchfile 0.91% Go 15.98% JavaScript 2.33% Python 21.09% HTML 3.89%

kubernetes-chaos's Introduction

Building resilient APIs with chaos engineering 🔥

The example that follows supports an article published on Better Practices. Learn more about Building resilient APIs with chaos engineering.

Get Started

This sample app is forked from Google's Hipster Shop: Cloud-Native Microservices Demo Application - a web-based e-commerce app called “Hipster Shop” where users can browse items, add them to the cart, and purchase them. The application works on any Kubernetes cluster (such as a local one).

Set up Gremlin and create a Kubernetes cluster on EKS

Start with this guide to Install Gremlin to use with Amazon EKS. You'll need an AWS account, the AWS CLI configured to use eksctl to create the EKS cluster, and a Gremlin account.

  • Step 0 - Verify your account AWS CLI Installation
  • Step 1 - Create an EKS cluster using eksctl
  • Step 2 - Load up the kubeconfig for the cluster
  • Step 3 - Deploy Kubernetes Dashboard
  • Step 4 - Deploy a Microservice Demo application
  • Step 5 - Run a Shutdown Container Attack using Gremlin (skip)

hipster shop

Set up Grafana and Prometheus

You'll need to a way to observe the results of your attack. You can skip this step if you have a different way to do this.

Proceed with Monitoring Kubernetes clusters with Grafana. This particular guide starts with Google Kubernetes Engine (GKE) instead of EKS, but most of the steps are the same after you've create your cluster.

  • Step 0 - Create a GKE cluster (skip)
  • Step 1 - Lots and lots and lots of yaml configuration
  • Step 2 - Configure your cluster settings on Grafana (skip)

Instead of configuring your cluster settings on Grafana, you can simply import an existing dashboard if your monitoring tools are running on your cluster.

grafana dashboard 3131

Use Postman to shut down a single container via the Gremlin API

In the Postman app, import the template called Chaos engineering that includes the chaosEngineering environment, and then look for the folder called Shut down a container. You will need to update the Postman environment with your gremlin_api_key and your_deployed_app_url.

Run in Postman

Read the Chaos engineering collection documentation for step-by-step instructions.

  1. Get a list of all active containers
  2. Create a shutdown attack on a specific container
  3. Verify app health
  4. Stop the attack (if you need to) attack in postman 500 error collection runner

A few gotchas

Managing Users or IAM Roles for your AWS EKS cluster

If you're using aws-iam-authenticator to manage your clusters from the CLI and have an MFA authentication requirement, you may need to get a session token, and update a separate profile in your /.aws/credentials in order to use the CLI and build a programmatic solution.

Configuring your EKS cluster in Grafana

Your configuration will depend on where you've deployed your Kubernetes cluster and Grafana. I opted to have Grafana and Prometheus running on my cluster.

You can use an ingress controller to manage external access to the apps running inside the cluster like ingress-nginx.

  • You might also need a service that automatically creates and manages TLS certs in Kubernetes like cert-manager (as in this tutorial).

Additionally, you can use an existing Grafana dashboard like this one for an overview of all nodes in a Kubernetes Cluster. There are other options as well.

  • Configuring your cluster in Grafana using the kubernetes-app plugin is not super well-documented, so these notes might help.
  • TLS certs are required for authentication using the plugin, and EKS doesn't support TLS. You can try using a different managed service like GKE (as in this tutorial), or many more steps will be required (if you're using the plugin).

kubernetes-chaos's People

Contributors

ahmetb avatar alpire avatar askmeegs avatar c24t avatar chroto avatar daniel-sanche avatar davidebbo avatar davidstanke avatar dbolkensteyn avatar dgageot avatar di avatar dineshnagarit avatar enocom avatar evansjwang avatar grayside avatar idvoretskyi avatar jan25 avatar jba avatar jkwlui avatar kalyanac avatar loopdelicious avatar lumpygator avatar michaelawyu avatar mtwo avatar ocervell avatar orthros avatar rghetia avatar ryuheechul avatar sebright avatar ymotongpoo 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.