Code Monkey home page Code Monkey logo

k8s-goku's Introduction

K8S Goku

K8s Goku helps to debug production applications locally without impacting your production system.

Features:

  • Relay captured requests to a locally running application (or anywhere the host running the consumer can reach)
  • Save requests to disk /when using together with an endpoint this also captures the response and request duraion)
  • Transparent to your production traffic
  • Multiple consumers can be attached at the same time

Requirements:

  • Kuberneters Cluster and the ability to use port-forward
  • Project Contour as ingress controller (Others using HTTPProxies might work as well if they support mirroring)
  • NodeJS on the host

Quickstart

You need a small deployment to your kubernetes cluster to get the "listener" deployed.

K8s-goku is atm designed to work with Projectcontour.io style HTTPProxies.

Deploy to kubernetes

kubectl apply -f k8s-deploy/deploy.yaml

Mirror traffic in contour

Go to edit your HTTPProxy and add this to the services:

- mirror: true
  name: k8s-goku
  port: 8000

Your routes should now look somwthing like this:

routes:
  - conditions:
    - prefix: /
    services:
    - name: my-normal-service
      port: 5000
    - mirror: true
      name: k8s-goku
      port: 8000

Port forward the redis

Enable a port forward via the Kubernetes API server:

kubectl port-forward k8s-goku-redis-69dbfc9576-x9w5d 6000:6379

This will expose the k8s-goku redis on localhost:6000

Run the consumer

To relay the traffic to your local debug app:

node src/consumer.js -r localhost -p 6000 -e <url-of-your-debug-app>

Consumer options

Usage: consumer [options]

Options:
  -V, --version           output the version number
  -e, --endpoint <url>    Endpoint to send requests to
  -n, --name <name>       Name of current run - if omitted a name is generated (run-<timestamp>) (default: "run-1627500598430")
  -s, --save              Save requests and responses
  -r, --redishost <host>  IP/Hostname of redis
  -p, --redisport <port>  port of redis (default: "6379")
  -h, --help              display help for command

k8s-goku's People

Contributors

elasticroentgen avatar

Stargazers

Parithosh Jayanthi avatar

Watchers

 avatar  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.