close
Skip to content

Latest commit

 

History

History

README.md

Kubemate — Kubernetes DevOps Chatbot & Log Anomaly Detector

Overview

Kubemate is a Flask-based AI-powered chatbot designed for Kubernetes DevOps practitioners to analyze logs, YAMLs, Dockerfiles, and provide troubleshooting insights using Google Gemini via LangChain. It also includes a simple anomaly detection capability for logs.

This project demonstrates a full DevOps workflow:

  • Local development with Python and Flask
  • Containerization with Docker
  • Cloud deployment on AWS Elastic Beanstalk with Docker support
  • Environment variable management
  • Session-based multi-turn chat memory

Features

  • Paste logs or upload files (log, YAML, Dockerfile) to analyze
  • Uses Google Gemini LLM through LangChain for context-aware DevOps assistance
  • Maintains chat history per session
  • Clear chat history button
  • Containerized for easy deployment
  • Deployable to AWS Elastic Beanstalk with Docker
  • Basic anomaly detection on logs (can be extended)

Prerequisites

  • Python 3.10+

  • Docker installed

  • AWS CLI installed and configured

  • EB CLI installed (pip install awsebcli)

  • AWS Account (Free tier supported)

  • .env file containing:

    GEMINI_API_KEY=your_google_gemini_api_key_here
    

Local Setup

1. Clone repo and install dependencies

git clone https://github.com/yourusername/kubemate.git
cd kubemate
pip install -r requirements.txt

2. Run locally

python main.py

Access the app: http://localhost:5000


Docker

1. Build Docker image

docker build -t kubemate .

2. Run Docker container

docker run -p 5000:5000 kubemate

Open http://localhost:5000


AWS Elastic Beanstalk Deployment

Step 1: Initialize EB Application

eb init
  • Select your region
  • Choose existing app or create new
  • Platform: Docker running on 64bit Amazon Linux 2023
  • SSH setup: optional

Step 2: Create EB Environment

eb create kubemate-env

Step 3: Set Environment Variables

Set your Gemini API key:

Via AWS CLI:

aws elasticbeanstalk update-environment \
  --environment-name kubemate-env \
  --option-settings Namespace=aws:elasticbeanstalk:application:environment,OptionName=GEMINI_API_KEY,Value=your_api_key_here \
  --region your_aws_region

Or via AWS Console: Elastic Beanstalk → kubemate-env → Configuration → Software → Environment Properties


Step 4: Deploy Application

eb deploy

Step 5: Open Application in Browser

eb open

Step 6: View Logs (Optional)

eb logs

Step 7: Terminate Environment (when done)

To stop all resources and avoid charges:

eb terminate kubemate-env

To remove application and all environments entirely:

eb terminate kubemate-env --all

Additional Tips

  • Add a /health route in Flask for Elastic Beanstalk health checks:
@app.route("/health")
def health():
    return "OK", 200
  • Make sure your Dockerfile is correctly formatted:
FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 5000

CMD ["python3", "main.py"]
  • For multi-turn chat persistence, Flask sessions are used; no external DB required.