Files
metalcheck/README.md
2024-12-05 03:06:01 +00:00

2.8 KiB

MetalCheck Backend

MetalCheck is a backend service that provides real-time insights into virtual machines, physical nodes, and Kubernetes clusters. It supports deployment in an EKS environment and offers features like data aggregation, export, and pseudographics visualization.


Features

  • Metal Nodes: Track hardware details like CPU, memory, and storage for physical nodes.
  • Virtual Machines: Monitor VMs from cloud providers like Hetzner.
  • Kubernetes Clusters: Query Kubernetes clusters to gather node and namespace data.
  • Data Export: Export collected data in JSON or YAML format.
  • Pseudographics: Terminal-based data visualization (optional).

Project Structure

Project Structure

metal-check-backend/
├── app/
│   ├── __init__.py       # Initialization
│   ├── main.py           # FastAPI entry point
│   ├── database.py       # SQLite DB setup and operations
│   ├── extras/
│   │   ├── pseudographics.py # CLI visualization tools
│   ├── routes/
│   │   ├── __init__.py   # Initialization for routes
│   │   ├── metal.py      # Routes for metal nodes
│   │   ├── vm.py         # Routes for virtual machines
│   │   ├── k8s.py        # Routes for Kubernetes clusters
│   │   ├── export.py     # Data export routes
│   ├── example/k8s/
│   │   ├── rbac.yaml     # RBAC configuration for Kubernetes
│   │   ├── deployment.yaml # Deployment configuration for EKS
├── Dockerfile            # Docker container configuration
├── requirements.txt      # Python dependencies
├── .dockerignore         # Files to ignore during image build
└── README.md             # Project documentation

Setup and Deployment

Prerequisites

  • Python 3.10+
  • Docker and kubectl installed
  • Access to an EKS cluster
  • AWS CLI configured with appropriate permissions

Build and Deploy

Build and Push Docker Image

docker build -t metalcheck-backend .
docker tag metalcheck-backend:latest <your-ecr-repo>:latest
docker push <your-ecr-repo>:latest

Deploy to EKS

Apply RBAC and deployment configurations:

kubectl apply -f app/example/k8s/rbac.yaml
kubectl apply -f app/example/k8s/deployment.yaml

Access the Service

Retrieve the LoadBalancer IP:

kubectl get svc -n metalcheck

Test the API:

curl http://<EXTERNAL-IP>/k8s/data

Endpoints

Method Endpoint Description
GET /metal/data Get all physical node data
POST /metal/data Add a new physical node
GET /vm/data Get all virtual machine data
POST /vm/data Add a new virtual machine
GET /k8s/data Get Kubernetes cluster information
GET /export Export data in JSON or YAML format