Code Monkey home page Code Monkey logo

troxileia's Introduction

Troxileia

Troxileia is a Kubernetes controller that reconfigures a network tap if pods are consistently crashing on a node and/or if "sensor" label on a node is changed from true to false. Troxileia is designed to be used with sensors like Zeek, Moloch, and Suricata. It assures that the load balancing being done by the tap is consistent with the current state of the cluster.

Picture here

Requirements

Kubernetes (tested on 1.15)

Python 3.0+ (If ran locally)

Python Kubernetes library (If ran locally)

pip install kubernetes

How to Use

Troxileia can be run locally outside of the cluser or as its own pod inside the cluser. To use, all nodes need a "port" label and nodes you intend to monitor should have a sensor label:

#Kubernetes does not accept "/", change them to "_" in port name:
kubectl label nodes k8s-worker-1 port="1_1_x1"
kubectl label nodes k8s-worker-1 sensor="true"

The sensor label can be left off and added later, or initially set to false if they may be monitored later.

First the variables in troxileia-configmap.yaml and troxileia-secrets.yaml must be set. Edit those to match your setup. The secret file contains the username and password for the tap. These values must be passed in as base_64. Then the configmapand secret must be applied to the cluser:

kubectl apply -f troxileia-configmap.yaml
kubectl apply -f troxileia-secret.yaml

To get rid of plain-text username and password stored in secret yaml file:

rm troxileia-secret.yaml

If using RBAC, give proper permissions with a ClusterRoleBinding to a ServiceAccount:

#Create ServiceAccount
kubectl create serviceaccount troxileia -n=kube-system
#Apply ClusterRole yaml
kubectl apply -f troxileia_clusterrole.yaml
#Create ClusterRoleBinding that binds ClusterRole to ServiceAccount
kubectl create clusterrolebinding troxileia --clusterrole=troxileia --serviceaccount=kube-system:troxileia

To run locally:

python main.py

To deploy as a pod in cluster in kube-system namespace:

kubectl apply troxileia.yaml

troxileia's People

Contributors

mbaker97 avatar miked235 avatar

Stargazers

 avatar

Forkers

barloff-st

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.