This is repository accompanies my article for the Tanzu Development Center
- Microservices with Spring Cloud Kubernetes Reference Architecture
This Reference Architecture demonstrates design, development, and deployment of Spring Boot microservices on Kubernetes. Each section covers architectural recommendations and configuration for each concern when applicable.
High-level key recommendations:
- Consider Best Practices in Cloud Native Applications and The 12 Factor App
- Keep each microservice in a separate Maven or Gradle project
- Prefer using dependencies when inheriting from parent project instead of using relative path
- Use Spring Initializr a web application that can generate a Spring Boot project structure, fill in your project details, pick your options, and download a bundled up project
This architecture demonstrates a complex Cloud Native application that addresses following concerns:
- Externalized configuration using ConfigMaps, Secrets, and PropertySource
- Kubernetes API server access using ServiceAccounts, Roles, and RoleBindings
- Health checks using Application Probes
- readinessProbe
- livenessProbe
- startupProbe
- Reporting application state using Spring Boot Actuators
- Service discovery across namespaces using DiscoveryClient
- Exposing API documentation using Swagger UI
- Building a Docker image using best practices
- Layering JARs using the Spring Boot plugin
- Observing the application using Prometheus exporters
-
OS: Mac or Linux
-
JDK 11.x
sdk install java 11.0.14-tem sdk use java 11.0.14-tem
git clone git@github.com:AndriyKalashnykov/spring-microservices-k8s.git
cd ./spring-microservices-k8s/scripts/
./start-cluster.sh
cd ./spring-microservices-k8s/scripts/
./setup-cluster.sh
cd ./spring-microservices-k8s/scripts/
./install-all.sh
cd ./spring-microservices-k8s/scripts/
./populate-data.sh
cd ./spring-microservices-k8s/scripts/
./employee-log.sh
cd ./spring-microservices-k8s/scripts/
./gateway-open.sh
cd ./spring-microservices-k8s/scripts/
./delete-all.sh
cd ./spring-microservices-k8s/scripts/
./destroy-cluster.sh
cd ./spring-microservices-k8s/scripts/
./stop-cluster.sh