GithubHelp home page GithubHelp logo

isabella232 / microservice-kubernetes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stakater/microservice-kubernetes

0.0 0.0 0.0 104 KB

Microservices example using Kubernetes

License: Apache License 2.0

Shell 9.91% Java 66.21% HTML 18.22% Batchfile 5.66%

microservice-kubernetes's 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. Only Spring Cloud Hystrix is used to add resilience.

microservice-kubernetes's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.