- Notifications
You must be signed in to change notification settings - Fork322
Sample Spring Boot application that uses some features provided by Spring Cloud Kubernetes, Spring Cloud OpenFeign and Spring Cloud Gateway deployed on Kubernetes
piomin/sample-spring-microservices-kubernetes
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
In this project I'm demonstrating you the most interesting features ofSpring Cloud Project for building microservice-based architecture that is deployed on Kubernetes. All the samples may be easily deployed on local Kubernetes single-node cluster - Minikube.
Currently you may find here some examples of microservices implementation using different projects from Spring Cloud. All the examples are divided into the branches and described in a separated articles on my blog. Here's a full list of available examples:
- Using Spring Boot and Spring Cloud for building microservices that may be easily deployed on Kubernetes. The example is available in the branchmaster. A detailed guide may be find in the following article: Detailed description can be found here:Quick Guide to Microservices with Kubernetes, Spring Boot 2.0 and Docker
- An introduction to Spring Cloud Kubernetes project, that shows its the most interesting features like discovery across many namespaces or Spring Boot property sources based on ConfigMap and Secret. The example is available in the branchhybrid. A detailed guide may be find in the following article: Detailed description can be found here:Microservices with Spring Cloud Kubernetes
- Using Spring Boot Admin to monitor Spring Boot applications running on Kubernetes. The example is available in the branchmaster. A detailed guide may be find in the following article:Spring Boot Admin on Kubernetes
- Download and runMinikube using command:
minikube start --vm-driver=virtualbox --memory='4000mb' - Build Maven project with using command:
mvn clean install - Build Docker images for each module using command, for example:
docker build -t piomin/employee:1.1 . - Go to
/kubernetesdirectory in repository - Apply all templates to Minikube using command:
kubectl apply -f <filename>.yaml - Check status with
kubectl get pods
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 KubernetesThe following picture illustrates the architecture described above including Kubernetes objects.
You can distribute applications across multiple namespaces and use Spring Cloud KubernetesDiscoveryClient andRibbon for inter-service communication.
Go to thek8s directory. You will find there several YAML scripts you need to apply before running applications.
privileges.yaml-RoleandRoleBindingfor Spring Cloud Kubernetes to allow access Kubernetes API from podmongo-secret.yaml- credentials for MongoDBmongo-configmap.yaml- user for MongoDBmongo-deployment.yaml-Deploymentfor MongoDBJust apply those scripts usingkubectl apply.
You can easily deploy all applications usingskaffold dev command.
About
Sample Spring Boot application that uses some features provided by Spring Cloud Kubernetes, Spring Cloud OpenFeign and Spring Cloud Gateway deployed on Kubernetes
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.

