https://github.com/akaspatranobis/spring-app-microservices-kubernetes
Sample Spring Boot application that uses some features provided by Spring Cloud Kubernetes, Spring Cloud OpenFeign and Spring Cloud Gateway deployed on Kubernetes
https://github.com/akaspatranobis/spring-app-microservices-kubernetes
configmaps docker gateway kubernetes microservices ribbon skaffold spring-boot spring-cloud-kubernetes swagger2 zuul
Last synced: 3 months ago
JSON representation
Sample Spring Boot application that uses some features provided by Spring Cloud Kubernetes, Spring Cloud OpenFeign and Spring Cloud Gateway deployed on Kubernetes
- Host: GitHub
- URL: https://github.com/akaspatranobis/spring-app-microservices-kubernetes
- Owner: akaspatranobis
- Created: 2024-12-31T14:25:04.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-01-08T11:57:24.000Z (5 months ago)
- Last Synced: 2025-01-17T05:11:59.286Z (5 months ago)
- Topics: configmaps, docker, gateway, kubernetes, microservices, ribbon, skaffold, spring-boot, spring-cloud-kubernetes, swagger2, zuul
- Language: Java
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Microservices with Spring Boot and Spring Cloud on Kubernetes Demo Project
[](https://circleci.com/gh/piomin/sample-spring-microservices-kubernetes)
[](https://sonarcloud.io/dashboard?id=piomin_spring-microservices-kubernetes)
[](https://sonarcloud.io/dashboard?id=piomin_spring-microservices-kubernetes)
[](https://sonarcloud.io/dashboard?id=piomin_spring-microservices-kubernetes)
[](https://sonarcloud.io/dashboard?id=piomin_spring-microservices-kubernetes)In this project I'm demonstrating you the most interesting features of [Spring Cloud Project](https://spring.io/projects/spring-cloud) for building microservice-based architecture that is deployed on Kubernetes. All the samples may be easily deployed on local Kubernetes single-node cluster - Minikube.
## Getting Started
### Usage
1. Download and run **Minikube** using command: `minikube start --vm-driver=virtualbox --memory='4000mb'`
2. Build Maven project with using command: `mvn clean install`
3. Build Docker images for each module using command, for example: `docker build -t piomin/employee:1.1 .`
4. Go to `/kubernetes` directory in repository
5. Apply all templates to Minikube using command: `kubectl apply -f .yaml`
6. Check status with `kubectl get pods`## Architecture
Our sample microservices-based system consists of the following modules:
- **gateway-service** - a module that Spring Cloud Netflix Zuul for running Spring Boot application that acts as a proxy/gateway in our architecture.
- **employee-service** - a module containing the first of our sample microservices that allows to perform CRUD operation on Mongo repository of employees
- **department-service** - a module containing the second of our sample microservices that allows to perform CRUD operation on Mongo repository of departments. It communicates with employee-service.
- **organization-service** - a module containing the third of our sample microservices that allows to perform CRUD operation on Mongo repository of organizations. It communicates with both employee-service and department-service.
- **admin-service** - a module containing embedded Spring Boot Admin Server used for monitoring Spring Boot microservices running on Kubernetes
The following picture illustrates the architecture described above including Kubernetes objects.
You can distribute applications across multiple namespaces and use Spring Cloud Kubernetes `DiscoveryClient` and `Ribbon` for inter-service communication.
## Before you start
Go to the `k8s` directory. You will find there several YAML scripts you need to apply before running applications.
1. `privileges.yaml` - `Role` and `RoleBinding` for Spring Cloud Kubernetes to allow access Kubernetes API from pod
2. `mongo-secret.yaml` - credentials for MongoDB
3. `mongo-configmap.yaml` - user for MongoDB
4. `mongo-deployment.yaml` - `Deployment` for MongoDB
Just apply those scripts using `kubectl apply`.You can easily deploy all applications using `skaffold dev` command.