A Spring Cloud On Kubernetes Example
- micrometer (for gathering metrics)
- actuator
- Prometheus
- Grafana
- Postgresql Sakila DB
- SpringBoot - The framework used
- Maven - Dependency Management
- Docker - Used to containerise the application
- Kubernetes - Used to generate a scalable cloud microservice
- DB Documentation - MySQL's Sample Salika (DVD Rental) Database
You will need:
- Docker desktop
- Docker-Kubernetes or Minikube (Kubernetes Dashboard or similar)
- Helm 3
- kubectl
- superbenchmarker
choco install superbenchmarker
uses aballaci/springboot-sakila-jpa:v3 in Dockerhub
you can build your own version:
docker build -t namespace/image-name:version .
docker push namespace/image-name:version
Set first the namespace in the current context -- the services should be installed in the same namespace.
kubectl config set-context --current --namespace=default
install prometheus:
helm install prometheus ./prometheus
install the postgres persistent volumes that populate the database:
kubectl create -f persistent-volume.yml
install postgres
helm install postgres postgresql/
install grafana:
helm upgrade grafana ./grafana/
create the prometheus datasource:
url: http://prometheus-server
access: Server(default)
install the dashboard in grafana importing it from grafana_dashboard_spring-boot-statistics_rev2.json
kubectl apply -f springboot-jpa.yaml
or for local development
skaffold dev
to make the builds faster use a nexus docker image as proxy... more on that later...
Metrics: http://localhost:8080/actuator/metrics
Metrics in prometheus format: http://localhost:8080/actuator/prometheus
Grafana dashboard:
`Run the load tests: sh load-test.sh
- Actors - http://localhost:{port}/actors
- Films - http://localhost:{port}/film
- Actorinfo - http://localhost:{port}/actorinfo
- Custom Query - http://localhost:{port}/actorinfo/search/findByActorsLastName?name=GUINESS
I use SemVer for versioning. For the versions available, see the tags on this repository.
- Armand Ballaci
This project is licensed under the MIT License - see the LICENSE.md file for details