SpringBoot + influxDB + grafana
There are two spring-boot apps here:
- app-with-metrics sends CPU and RAM metrics to local influx db
- proactive-scaler reads metrics from influx db
- start influx db locally
docker run -p 8086:8086 \
-v influxdb:/var/lib/influxdb \
influxdb
- start metrics app & scaler app with IDEA or java -jar
kubectl create -f kubernetes/app-with-metrics.yaml
kubectl expose deployment metrics-app --type=NodePort
minikube service metrics-app --url
- start scaler app with IDEA or java -jar
kubectl scale deployment metrics-app --replicas=[SIZE]
where [SIZE] is pod count
kubectl autoscale deployment metrics-app --max=3 --cpu-percent=80
kubectl delete horizontalpodautoscaler metrics-app
./clearDatabase.sh
SELECT count("id") FROM "connection" WHERE $timeFilter GROUP BY time(1s) fill(null)
SELECT mean("cpu") FROM "workload" WHERE $timeFilter GROUP BY time(1s) fill(null)
SELECT count("method") FROM "connection" WHERE ("method" = 'cpu') AND $timeFilter GROUP BY time(10s) fill(null)