• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ewolff/microservice-kubernetes: Microservices example using Kubernetes

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

ewolff/microservice-kubernetes

开源软件地址(OpenSource Url):

https://github.com/ewolff/microservice-kubernetes

开源编程语言(OpenSource Language):

Java 75.3%

开源软件介绍(OpenSource Introduction):

Microservice Kubernetes Sample

Deutsche Anleitung zum Starten des Beispiels

This sample is like the sample for my Microservices Book (English / German) that you can find at https://github.com/ewolff/microservice .

However, this demo uses Kubernetes as Docker environment. Kubernetes also support service discovery and load balancing. An Apache httpd as a reverse proxy routes the calls to the services.

This project creates a complete micro service demo system in Docker containers. The services are implemented in Java using Spring and Spring Cloud.

It uses three microservices:

  • Order to process orders.
  • Customer to handle customer data.
  • Catalog to handle the items in the catalog.

How to run

See How to run.

Apache HTTP Load Balancer

Apache HTTP is used to provide the web page of the demo at port 8080. It also forwards HTTP requests to the microservices. This is not really necessary as each service has its own port on the Minikube host but it provides a single point of entry for the whole system. Apache HTTP is configured as a reverse proxy for this. Load balancing is left to Kubernetes.

To configure this Apache HTTP needs to get all registered services from Kubernetes. It just uses DNS for that.

Please refer to the subdirectory microservice-kubernetes-demo/apache to see how this works.

Remarks on the Code

The microservices are:

The microservices use REST to communicate to each other. See e.g. CatalogClient . The hostname is configurable to allow tests with stubs. The default is catalog which works with Kubernetes. Other microservices are found using Kubernetes built-in DNS. Kubernetes does the load balancing on the IP level.

The microservices have a Java main application in src/test/java to run them stand alone. microservice-demo-order uses a stub for the other services then. Also there are tests that use consumer-driven contracts. That is why it is ensured that the services provide the correct interface. These CDC tests are used in microservice-demo-order to verify the stubs. In microservice-kubernetes-demo-customer and microserivce-kubernetes-demo-catalog they are used to verify the implemented REST services.

Note that the code has no dependencies on Kubernetes.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
rxi/json.lua: A lightweight JSON library for Lua发布时间:2022-07-08
下一篇:
cweiske/jsonmapper: Map nested JSON structures onto PHP classes发布时间:2022-07-08
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap