Giter Site home page Giter Site logo

k8guard-start-from-here's Introduction

K8Guard


About

Name

  • K8Guard is auditing system for kuberentes, It is pronounced like Kate Guard. like a guardian angel for your kubernetes clusters. it is open source and developed by Target Corp.

Features

  • Discovers violations in a kubernetes cluster.
  • Notifies and warns the namespace owners before doing hard actions. (via email or chat)
  • Ceans up the violating entities.
  • Generates report and metrics of violations and actions.
  • Provides an API for integration.
  • Highly configurable for different needs.

Violations Examples

  1. Invalid Image Size (5 GB image)
  2. Invalid Image Repo (Download image from a shady repo in internet?)
  3. Extra Capabilities (change UID and PID?)
  4. Privileged Mode (admin rights on the container?)
  5. Host Volumes Mounted (mount the kubernetes file system on your container?)
  6. Single Replica Deployment (Didn't read 12-factor?)
  7. Invalid Ingress (Have * in your ingress? Or a bad word?)

Microservices

  • Discover: Finds violations
  • Action: Notifies violators and does action on them.
  • Report: Generates human readable/searchable reports of the violations and actions.

Requirements

  1. System level token for a Kubernetes cluster.
Optional:
  1. A Kafka topic. (only if you need the action service)
  2. A Cassandra keyspace. (only if you want to use action and report service)
  3. Prometheus Server (only if you need metrics and grafana dashboards)

First Time Developer Setup

  • Install Go and Setup your setup your $GOPATH.

  • First clone this repo this way:

     mkdir -p $GOPATH/src/github.com/k8guard/
     cd $GOPATH/src/github.com/k8guard/
     git clone https://github.com/k8guard/k8guard-start-from-here.git
     cd $GOPATH/src/github.com/k8guard/k8guard-start-from-here
    
  • k8guard-start-from-here folder is your where you wanna be, when run this project.

  • Run developer-setup:

     make developer-setup
    
    • Hint 1: The above steps will clone other repos (k8guardlibs, k8guard-discover, k8guard-action, k8guard-report), and install golang tools (glide, goimport) for you, and also will setup the pre-commits hooks. note: it uses brew to install glide for only for mac users currently.

    • Hint 2: Makefile is your friend and it is better than this documentation. take a look at the Makefile in the root of this folder, to undrestand all the commands you need.

Build Before Deploy

  • To Build all the micro-services:

     make build-all
    
    • Hint: you can build each micro-service individually if you don't wanna build all of them:
      • make build-discover
      • make build-action
      • make build-report

Deploy

You can choose to either deploy in minikube or run in in docker-compose. all batteries are included (kafka, cassandra, memcached)

Run in docker-compose

  1. Config : edit .env and env-creds files. (default values should work fine.)

  2. Bring the core (cassandra, kafka, memcached):

    make up-core
    
  3. Bring up action, in a new terminal run:

    make up-action
    
  4. Bring up discover, in a new terminal run:

    make up-discover
    
  5. To bring up action, in a new terminal run:

    make up-action
    
  6. Open the Discover api url in the browser:

    http://localhost:3000
    
  7. Open the Report service url in the browser:

    http://localhost:3001
    

Clean up docker-compose

  • To clean the docker-compose

     make clean
    
  • Hint alternatively, you can clean individual services:

    make clean-action

    make clean-discover

    make clean-report

    make clean-core

Run in minikube

Make sure you have installed minkube and edit the config maps and secrets inside the minikube folder for each service, and follow these steps:

  1. minikube start --kubernetes-version v1.5.1
  2. eval $(minikube docker-env)
  3. make deploy-minikube

Give it a couple minutes. and hit the service urls:

  • Get discover service url:

    minikube service k8guard-discover-service

  • Get report service url:

    minikube service k8guard-report-service

Clean up minikube

To delete the deployment in minikube:

make clean-minikube

k8guard-start-from-here's People

Contributors

brianberzins avatar medyagh avatar milsonian avatar rmb938 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.