{"id":16119716,"url":"https://github.com/piomin/sample-spring-microservices-kubernetes","last_synced_at":"2025-05-15T09:07:13.293Z","repository":{"id":44337617,"uuid":"143009107","full_name":"piomin/sample-spring-microservices-kubernetes","owner":"piomin","description":"Sample Spring Boot application that uses some features provided by Spring Cloud Kubernetes, Spring Cloud OpenFeign and Spring Cloud Gateway deployed on Kubernetes","archived":false,"fork":false,"pushed_at":"2025-05-14T01:48:12.000Z","size":248,"stargazers_count":472,"open_issues_count":4,"forks_count":308,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-05-14T03:28:39.630Z","etag":null,"topics":["configmap","docker","kubernetes","microservices","minikube","openshift","ribbon","spring-boot","spring-cloud","spring-cloud-kubernetes","swagger2","zuul"],"latest_commit_sha":null,"homepage":"https://piotrminkowski.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piomin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-07-31T12:08:43.000Z","updated_at":"2025-05-14T01:48:15.000Z","dependencies_parsed_at":"2023-12-03T05:26:02.289Z","dependency_job_id":"a17d1068-7c5f-4f90-955f-33938599324e","html_url":"https://github.com/piomin/sample-spring-microservices-kubernetes","commit_stats":{"total_commits":165,"total_committers":5,"mean_commits":33.0,"dds":"0.36969696969696975","last_synced_commit":"1dc574273fcd10f57d68ed5508f5ca60a0be59ec"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-microservices-kubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-microservices-kubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-microservices-kubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piomin%2Fsample-spring-microservices-kubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piomin","download_url":"https://codeload.github.com/piomin/sample-spring-microservices-kubernetes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310515,"owners_count":22049469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configmap","docker","kubernetes","microservices","minikube","openshift","ribbon","spring-boot","spring-cloud","spring-cloud-kubernetes","swagger2","zuul"],"created_at":"2024-10-09T20:54:52.867Z","updated_at":"2025-05-15T09:07:08.283Z","avatar_url":"https://github.com/piomin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microservices with Spring Boot and Spring Cloud on Kubernetes Demo Project [![Twitter](https://img.shields.io/twitter/follow/piotr_minkowski.svg?style=social\u0026logo=twitter\u0026label=Follow%20Me)](https://twitter.com/piotr_minkowski)\n\n[![CircleCI](https://circleci.com/gh/piomin/sample-spring-microservices-kubernetes.svg?style=svg)](https://circleci.com/gh/piomin/sample-spring-microservices-kubernetes)\n\n[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-black.svg)](https://sonarcloud.io/dashboard?id=piomin_spring-microservices-kubernetes)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=piomin_spring-microservices-kubernetes\u0026metric=bugs)](https://sonarcloud.io/dashboard?id=piomin_spring-microservices-kubernetes)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=piomin_spring-microservices-kubernetes\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=piomin_spring-microservices-kubernetes)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=piomin_spring-microservices-kubernetes\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=piomin_spring-microservices-kubernetes)\n\nIn 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.\n\n\n## Getting Started \nCurrently 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:\n1. Using Spring Boot and Spring Cloud for building microservices that may be easily deployed on Kubernetes. The example is available in the branch [master](https://github.com/piomin/sample-spring-microservices-kubernetes/tree/master). 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](https://piotrminkowski.com/2018/08/02/quick-guide-to-microservices-with-kubernetes-spring-boot-2-0-and-docker/) \n2. 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 branch [hybrid](https://github.com/piomin/sample-spring-microservices-kubernetes/tree/hybrid). A detailed guide may be find in the following article: Detailed description can be found here: [Microservices with Spring Cloud Kubernetes](https://piotrminkowski.com/2019/12/20/microservices-with-spring-cloud-kubernetes/)\n3. Using Spring Boot Admin to monitor Spring Boot applications running on Kubernetes. The example is available in the branch [master](https://github.com/piomin/sample-spring-microservices-kubernetes/tree/master). A detailed guide may be find in the following article: [Spring Boot Admin on Kubernetes](https://piotrminkowski.com/2020/02/18/spring-boot-admin-on-kubernetes/)\n\n### Usage\n1. Download and run **Minikube** using command: `minikube start --vm-driver=virtualbox --memory='4000mb'` \n2. Build Maven project with using command: `mvn clean install`\n3. Build Docker images for each module using command, for example: `docker build -t piomin/employee:1.1 .`\n4. Go to `/kubernetes` directory in repository\n5. Apply all templates to Minikube using command: `kubectl apply -f \u003cfilename\u003e.yaml`\n6. Check status with `kubectl get pods`\n\n## Architecture\n\nOur sample microservices-based system consists of the following modules:\n- **gateway-service** - a module that Spring Cloud Netflix Zuul for running Spring Boot application that acts as a proxy/gateway in our architecture.\n- **employee-service** - a module containing the first of our sample microservices that allows to perform CRUD operation on Mongo repository of employees\n- **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. \n- **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.\n- **admin-service** - a module containing embedded Spring Boot Admin Server used for monitoring Spring Boot microservices running on Kubernetes\nThe following picture illustrates the architecture described above including Kubernetes objects.\n\n\u003cimg src=\"https://piotrminkowski.files.wordpress.com/2018/07/micro-kube-1.png\" title=\"Architecture1\"\u003e\n\nYou can distribute applications across multiple namespaces and use Spring Cloud Kubernetes `DiscoveryClient` and `Ribbon` for inter-service communication.\n\n\u003cimg src=\"https://piotrminkowski.files.wordpress.com/2019/12/microservices-with-spring-cloud-kubernetes-discovery.png\" title=\"Architecture2\" \u003e\n\n## Before you start\nGo to the `k8s` directory. You will find there several YAML scripts you need to apply before running applications.\n1. `privileges.yaml` - `Role` and `RoleBinding` for Spring Cloud Kubernetes to allow access Kubernetes API from pod\n2. `mongo-secret.yaml` - credentials for MongoDB\n3. `mongo-configmap.yaml` - user for MongoDB\n4. `mongo-deployment.yaml` - `Deployment` for MongoDB\nJust apply those scripts using `kubectl apply`.\n\nYou can easily deploy all applications using `skaffold dev` command.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiomin%2Fsample-spring-microservices-kubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiomin%2Fsample-spring-microservices-kubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiomin%2Fsample-spring-microservices-kubernetes/lists"}