• Stars
    star
    201
  • Rank 193,992 (Top 4 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Microservices example using Kubernetes

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.

More Repositories

1

microservice

Sample of a Microservice setup for my book. Based on Spring Cloud / Netflix / Java / Docker / Docker Compose / Docker Machine / Vagrant
Java
712
star
2

microservice-kafka

Demo to show how Apache Kafka can be used for communication between microservices
Java
579
star
3

microservice-istio

Example for a microservices system based in Kubernetes and the service mesh Istio
Java
185
star
4

microservice-consul

Sample of a Microservice setup for my book ported to Consul / Apache httpd. Based on Spring Cloud / Netflix / Java / Docker / Docker Compose / Docker Machine
Java
104
star
5

user-registration

Continuous Delivery example: Chef, Docker, Jenkins, Graphite, ELK stack, jBehave, Selenium, Gatling
Ruby
65
star
6

InformatikFAQ

Informatik als Beruf FAQ
51
star
7

SCS-ESI

Demo for Self-contained Systems (SCS) using ESI (Edge Side Includes) with Varnish for Frontend Integration
Java
44
star
8

user-registration-V2

Java
38
star
9

spring-boot-demos

Some demos for Spring Boot
Java
38
star
10

microservice-atom

Demo to show how Atom can be used for communication between microservices
Java
31
star
11

microservice-consul-dns

Microservices Demo. Uses Consul as DNS server, registration is automated using Registrator
Java
21
star
12

microservice-linkerd

Microservices example with Linkerd service mesh
Java
16
star
13

crimson-assurance-demo

Demo for frontend integration
Dockerfile
14
star
14

cheatsheets-DE

Kurze Ãœbersichten / Cheatsheets zu Maven und Docker
14
star
15

microservice-spring

A microservices sample using Spring Boot features
Java
14
star
16

scala-spring

Shows how Scala and Spring can be integrated
Scala
12
star
17

microservice-cloudfoundry

Microservices demo using Cloud Foundry
Java
12
star
18

software-architektur.tv

software-architektur.tv Website
CSS
10
star
19

SCS-jQuery

Demo for Self-contained Systems (SCS) using jQuery for Frontend Integration
Java
9
star
20

microservices-rezepte

Source für Broschüre "Microservices Rezepte"
9
star
21

Spring-Integration-Web-Services-Batch-Demo

Demo of Spring Web Services, Spring Batch and Spring Integration
Java
8
star
22

microservices-primer

Source for booklet "Microservices Primer"
Shell
8
star
23

microservice-dapr

A microservices sample using Dapr
Java
7
star
24

spring-redis-demo

Shows how Spring can be used to access the Redis NoSQL store
Java
6
star
25

bildungsinitiativen

List von verschiedenen Bildungsinitiativen im Bereich Software-Entwicklung
5
star
26

docker-java

Very small Java image for Docker
5
star
27

microservices-vm

Creates a virtual machine with the Microservices demo and the Continuous Delivery demo
Shell
4
star
28

microservices-ueberblick

Source für Broschüre "Microservices Überblick"
4
star
29

lvm-demo

LVM Demo shows principles of ROCA and SCS
3
star
30

Spring-Buch

Repository for the Spring book (German)
Java
2
star
31

ewolff.com

Eberhard Wolff's Homepage
CSS
2
star
32

service-mesh-primer

Source for booklet "Service Mesh Primer"
Makefile
2
star
33

seneca-example

A simple example using the Seneca framework
JavaScript
2
star
34

practical-microservices.com

XSLT
2
star
35

microservices-recipes

Source for booklet "Microservices Recipes"
2
star
36

spring-buch.de

Website für das Spring Buch
HTML
1
star
37

JavaChefVagrantEC2

Ruby
1
star
38

spring-rabbit-demo

Demo how to use Spring AMQP and RabbitMQ
Java
1
star
39

microservices-buch.de

Website für das Microservices Buch
XSLT
1
star
40

redis-docker

Redis installation with Docker
Shell
1
star
41

news-application-heroku

Java
1
star
42

war-demo

Demo for Nanoservices using WARs and Tomcat
Java
1
star
43

microservices-praxisbuch.de

XSLT
1
star
44

continuous-delivery-buch.de

Website für das Continuous Delivery Buch
XSLT
1
star
45

erlang-example

Simple example for an Erlang client / server
Erlang
1
star