Scale Pilot is a Kubernetes-based automation tool designed to dynamically manage Horizontal Pod Autoscaler (HPA) configurations based on predefined events. It provides a flexible and configurable way to scale your Kubernetes workloads up or down according to specific events or schedules.
- 🔄 Dynamic HPA min-replica count management
- ⏰ Configurable event-based scaling
- 🔔 Slack notifications for scaling events
- 🔄 Automatic reversion of scaling changes
- 📝 YAML-based configuration
- 🔒 Kubernetes-native implementation
- Event-driven scaling for high-traffic periods
- Scheduled scaling for maintenance windows
- Automated scaling for special events or promotions
- Temporary capacity adjustments
- Kubernetes cluster
- Python 3.9+
- Kubernetes Python client
- External Secrets Operator installed in the cluster
- GCP Secret Manager (or other supported secret provider)
- Slack webhook URL (for notifications)
- Clone the repository:
git clone https://github.com/yourusername/scale-pilot.git
cd scale-pilot- Install dependencies:
pip install -r requirements.txt-
Configure External Secrets:
- Navigate to the
k8sdirectory - Update the namespace in
gcp-external-secrets.yamlto your target namespace - Create the following secrets in your GCP Secret Manager:
scale-pilot-config-file: Contains your scaling configurationscale-pilot-env: Contains environment variablesscale-pilot-eventname: Contains the eventname and the corresponding value from config file is selected for scaling.
- Apply the external secrets:
kubectl apply -f k8s/gcp-external-secrets.yaml
- Navigate to the
-
Deploy the CronJob:
kubectl apply -f k8s/cronjob.yaml
Store your configuration in GCP Secret Manager with the following structure:
eventName-1:
- name: hpa-1
minCount: 4
- name: hpa-2
minCount: 5
eventName-2:
- name: hpa-1
minCount: 4
- name: hpa-2
minCount: 5Required environment variables in scale-pilot-env:
SLACK_WEBHOOK_URL=your_slack_webhook_url
SLEEP_TIME=900
NAMESPACE=your_namespace
Required environment variables in scale-pilot-eventname:
EVENT_NAME=<Must match any of the elements in config.yaml>
Scale Pilot operates as a Kubernetes CronJob that:
- Reads event configurations from mounted secrets
- Updates HPA min-replica counts
- Sends notifications via Slack
- Reverts changes after a configurable period
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on GitHub.
- Kubernetes Python Client
- Python-dotenv
- PyYAML
- External Secrets Operator