This project implements a real-time machine learning service for detecting anomalies in Azure Kubernetes Service (AKS) metrics. It continuously monitors a dataset of AKS metrics and trains a Random Forest model to classify packet loss anomalies.
- Real-time dataset monitoring
- Automated model training on dataset updates
- Packet loss anomaly classification
- Model persistence and versioning
- Docker containerization for easy deployment
- Kubernetes deployment via Helm chart
- Python 3.9+
- Docker
- Kubernetes cluster
- Helm 3.x
- Required Python packages (see requirements.txt)
.
├── Dockerfile # Docker configuration
├── ML.py # Main ML training script
├── README.md # Project documentation
├── requirements.txt # Python dependencies
├── final_dataset.csv # Training dataset
├── aces-ml-chart/ # Helm chart for Kubernetes deployment
│ ├── Chart.yaml # Chart metadata
│ ├── values.yaml # Default configuration values
│ └── templates/ # Kubernetes manifest templates
└── models/ # Directory for saved models
└── random_forest_model.joblib
- Build the Docker image:
docker build -t ml-realtime .- Run the container:
docker run -it --rm -v $(pwd):/app -v $(pwd)/models:/app/models ml-realtime python ML.py- Add the Helm repository (if hosted):
helm repo add aces-ml https://your-helm-repo-url
helm repo update- Install the chart:
helm install aces-ml ./aces-ml-chart- Configure the deployment (optional):
helm install aces-ml ./aces-ml-chart --values custom-values.yamlThe service expects a CSV file named final_dataset.csv with the following columns:
- Timestamp
- Various AKS metrics (CPU, Memory, Network metrics)
- Abnormality class (target variable)
- Algorithm: Random Forest Classifier
- Features: AKS performance metrics
- Target: Packet Loss anomaly detection
- Model storage: Saved as .joblib file in models/ directory
The Helm chart provides the following customization options:
- Replica count and autoscaling configuration
- Resource limits and requests
- Ingress configuration
- Service type and port configuration
- Environment variables via ConfigMap
For detailed configuration options, see the values.yaml file.
Feel free to contribute to this project by submitting issues or pull requests.
Apache License 2.0
This project is licensed under the Apache License, Version 2.0. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0