Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Developing
Java based microservices
ready for the world of containers
@davsclaus
davsclaus
davsclaus.com
Claus Ibsen
I was here in 2015
.. and talking about Apache Camel
Claus Ibsen
• Principal Software Engineer

at Red Hat
• Apache Camel

8 years working with Camel
• Author of

Camel in Act...
?
?
OS Level Virtualization
Docker Orchestration
PaaS Platform on top of
Kubernetes
Services and Tools for
Kubernetes and Open...
Kubernetes
Kubernetes
‣ Open Source orchestration platform for Docker
containers
• Rewrite of Google’s internal framework “Borg”
‣ De...
Architecture
Key Concepts
‣Nodes
• Worker machine (physical or VM) running pods
‣Pods
• Collection of one or more Docker containers
‣Re...
What is Kubernetes?
http://blog.kubernetes.io/2016/06/illustrated-childrens-guide-
to-kubernetes.html
fabric8
‣ Tools and Services for value add to Kubernetes and
OpenShift
• Management: console, logging, metrics, dashboards...
Kubernetes
Demo Time
Java Developer
?
Build a
Camel Demo
Time
Hello Service
Hello
Service
Client
Hello Service
Hello
Service
name=Claus
Hi $name I am $HOSTNAME
Client
Implementation
Client Hello Service
HTTP
Apache

Tomcat
Spring Boot
Implementation
Hello
Service
Client Hello Service
HTTP
Implementation
Client Hello Service
HTTP
from timer
to http
log
from servlet
transform
helloservice
Hello Service
Client
Ready to run local
Client Hello Service
HTTP 8080
from timer
to netty
log
from servlet
transform
helloservice
How to build Docker Image?
Maven Project Docker Image
Docker Maven Plugin
Maven Project
Docker Maven
Plugin
Docker Image
build
Docker Maven Plugin

in pom.xml
Docker Maven Plugin

in pom.xml
Build Docker Image
mvn clean install docker:build
Local Docker Repository
Hello Service
Client
Our Demo
Client Hello Service
HTTP 8080
from timer
to http
log
from servlet
transform
helloservice
Static vs Dynamic Platform
Client Hello Service
HTTP 8080
from timer
to http
log
from servlet
transform
helloservice
Hardc...
Dynamic Platform
Hello Service
HTTP 8080
Client
from timer
to http
log
from servlet
transform
helloservice
Kubernetes
Serv...
Kubernetes Service
• Network Connection to one or more Pods
• Unique static IP and port (lifetime of service)
Kubernetes

Service
HTTP 8080
from timer
to http
log
from servlet
transform
helloservice
kubeproxy
Kubernetes
Master
enlis...
Kubernetes Service

from user point of view
service ip:port
from timer
to http
log
from servlet
transform
helloservice
pod...
Service defined

in pom.xml
Hello Service
from servlet
transform
helloservice
Container Port =
Inside
Service Port = Outside
Using Kubernetes
Service
Client
from timer
to http
log
We want to use hello service
How do we do that?
Using Kubernetes
Service
• Environment Variables
• Hostname
• Port
Client
from timer
to http
log
Service Discovery using D...
Camel using service
• Use {{service:hello}} Client
from timer
to http
log
Ready to run in Kubernetes
Client Hello Service
service:hello
from timer
to netty
log
from servlet
transform
helloservice
...
How to deploy to
Kubernetes?
Maven Project
How to deploy to
Kubernetes?
Maven Project
fabric8 Maven
Plugin
apply
Deploy - Hello Service
Hello Service
from servlet
transform
helloservice
• mvn -Pf8-local-deploy
Deploy - Client
• mvn -Pf8-local-deploy Client
from timer
to http
log
fabric8 Web Console
OpenShift CLI
• oc get pods
You can also use CLI from
docker &
kubernetes
OpenShift CLI
• oc get services
OpenShift CLI
• oc logs -f <pod name>
OpenShift CLI
No they are not Camel routes,

but networking routes.
• oc get routes
Scaling
• Change replication controller replicas
Scaling
• Service load balancing
Load balancing
is random
Angry Pods
1st person shooter - Kill your pods
Zipkin
Distributed message tracing
Zipkin
• camel-zipkin (coming in Camel 2.18)
• https://github.com/apache/camel/tree/master/
examples/camel-example-zipkin
...
Links
• fabric8
• http://fabric8.io
• https://blog.fabric8.io/
• Try kubernetes / fabric8
• http://fabric8.io/guide/getSta...
Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
Developing Java based microservices ready for the world of containers
Upcoming SlideShare
Loading in …5
×
Upcoming SlideShare
GAM SpeedSkating impressions
Next
Download to read offline and view in fullscreen.

4

Share

Download to read offline

Developing Java based microservices ready for the world of containers

Download to read offline

Developing Java based microservices ready for the world of containers

The so-called experts are saying microservices and containers will change the way we build, maintain, operate, and integrate applications. This talk is intended for Java developers who wants to hear and see how you can develop Java microservices that are ready to run in containers.

In this talk we will build a set of Java based Microservices that uses a mix of technologies with:
- Spring Boot with Apache Camel
- Apache Tomcat with Apache Camel

You will see how we can build small discrete microservices with these Java technologies and build and deploy on the Kubernets/OpenShift3 container platform.

We will discuss practices how to build distributed and fault tolerant microservices using technologies such as Kubernetes Services, Camel EIPs, Netflixx Hysterix, and Ribbon.

We will use Zipkin service tracing across all four Java based microservices to provide a visualization of timings and help highlight latency problems in our mesh of microservices.

And the self healing and fault tolerant aspects of the Kubernetes/OpenShift3 platform is also discussed and demoed when we let the chaos monkeys loose killing containers.

This talk is a 50/50 mix between slides and demo.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Developing Java based microservices ready for the world of containers

  1. 1. Developing Java based microservices ready for the world of containers @davsclaus davsclaus davsclaus.com Claus Ibsen
  2. 2. I was here in 2015 .. and talking about Apache Camel
  3. 3. Claus Ibsen • Principal Software Engineer
 at Red Hat • Apache Camel
 8 years working with Camel • Author of
 Camel in Action books @davsclaus davsclaus davsclaus.com
  4. 4. ?
  5. 5. ?
  6. 6. OS Level Virtualization Docker Orchestration PaaS Platform on top of Kubernetes Services and Tools for Kubernetes and OpenShift
  7. 7. Kubernetes
  8. 8. Kubernetes ‣ Open Source orchestration platform for Docker containers • Rewrite of Google’s internal framework “Borg” ‣ Declarative specification of a desired state ‣ Self-healing ‣ Service discovery ‣ Scheduling across hosts ‣ Replication
  9. 9. Architecture
  10. 10. Key Concepts ‣Nodes • Worker machine (physical or VM) running pods ‣Pods • Collection of one or more Docker containers ‣Replication Controller • Creates and takes care of Pods ‣Services • Network Proxy for a collection of Pods ‣Labels • Grouping and organization of Objects ‣Namespaces • Virtual clusters backend by same physical cluster
  11. 11. What is Kubernetes? http://blog.kubernetes.io/2016/06/illustrated-childrens-guide- to-kubernetes.html
  12. 12. fabric8 ‣ Tools and Services for value add to Kubernetes and OpenShift • Management: console, logging, metrics, dashboards, … • Continuous Delivery Workflow • iPaaS: Camel route visualization, API registry, Messaging as a Service, … • Tools: Kubernetes/OpenShift build integration, Kubernetes component test support, CDI extensions • Quickstarts: Ready to use examples, also available as Maven archetypes
  13. 13. Kubernetes Demo Time
  14. 14. Java Developer ?
  15. 15. Build a Camel Demo Time
  16. 16. Hello Service Hello Service Client
  17. 17. Hello Service Hello Service name=Claus Hi $name I am $HOSTNAME Client
  18. 18. Implementation Client Hello Service HTTP Apache
 Tomcat Spring Boot
  19. 19. Implementation Hello Service Client Hello Service HTTP
  20. 20. Implementation Client Hello Service HTTP from timer to http log from servlet transform helloservice
  21. 21. Hello Service
  22. 22. Client
  23. 23. Ready to run local Client Hello Service HTTP 8080 from timer to netty log from servlet transform helloservice
  24. 24. How to build Docker Image? Maven Project Docker Image
  25. 25. Docker Maven Plugin Maven Project Docker Maven Plugin Docker Image build
  26. 26. Docker Maven Plugin
 in pom.xml
  27. 27. Docker Maven Plugin
 in pom.xml
  28. 28. Build Docker Image mvn clean install docker:build
  29. 29. Local Docker Repository Hello Service Client
  30. 30. Our Demo Client Hello Service HTTP 8080 from timer to http log from servlet transform helloservice
  31. 31. Static vs Dynamic Platform Client Hello Service HTTP 8080 from timer to http log from servlet transform helloservice Hardcoded hostname and port
  32. 32. Dynamic Platform Hello Service HTTP 8080 Client from timer to http log from servlet transform helloservice Kubernetes Service
  33. 33. Kubernetes Service • Network Connection to one or more Pods • Unique static IP and port (lifetime of service)
  34. 34. Kubernetes
 Service HTTP 8080 from timer to http log from servlet transform helloservice kubeproxy Kubernetes Master enlisted on deployment changes pod node pod node
  35. 35. Kubernetes Service
 from user point of view service ip:port from timer to http log from servlet transform helloservice pod pod
  36. 36. Service defined
 in pom.xml Hello Service from servlet transform helloservice Container Port = Inside Service Port = Outside
  37. 37. Using Kubernetes Service Client from timer to http log We want to use hello service How do we do that?
  38. 38. Using Kubernetes Service • Environment Variables • Hostname • Port Client from timer to http log Service Discovery using DNS is available in newer versions of Kubernetes.
  39. 39. Camel using service • Use {{service:hello}} Client from timer to http log
  40. 40. Ready to run in Kubernetes Client Hello Service service:hello from timer to netty log from servlet transform helloservice kubeproxy
  41. 41. How to deploy to Kubernetes? Maven Project
  42. 42. How to deploy to Kubernetes? Maven Project fabric8 Maven Plugin apply
  43. 43. Deploy - Hello Service Hello Service from servlet transform helloservice • mvn -Pf8-local-deploy
  44. 44. Deploy - Client • mvn -Pf8-local-deploy Client from timer to http log
  45. 45. fabric8 Web Console
  46. 46. OpenShift CLI • oc get pods You can also use CLI from docker & kubernetes
  47. 47. OpenShift CLI • oc get services
  48. 48. OpenShift CLI • oc logs -f <pod name>
  49. 49. OpenShift CLI No they are not Camel routes,
 but networking routes. • oc get routes
  50. 50. Scaling • Change replication controller replicas
  51. 51. Scaling • Service load balancing Load balancing is random
  52. 52. Angry Pods 1st person shooter - Kill your pods
  53. 53. Zipkin Distributed message tracing
  54. 54. Zipkin • camel-zipkin (coming in Camel 2.18) • https://github.com/apache/camel/tree/master/ examples/camel-example-zipkin • kubernetes-zipkin • https://github.com/fabric8io/kubernetes-zipkin • https://github.com/fabric8io/kubeflix/blob/master/ examples/loanbroker/readme.md
  55. 55. Links • fabric8 • http://fabric8.io • https://blog.fabric8.io/ • Try kubernetes / fabric8 • http://fabric8.io/guide/getStarted/vagrant.html @davsclaus davsclaus davsclaus.com
  • MuhammadAslam23

    Nov. 13, 2016
  • ksobkowiak

    Jun. 19, 2016
  • TeressaWoodardYoung

    Jun. 19, 2016
  • micaelgallego

    Jun. 18, 2016

Developing Java based microservices ready for the world of containers The so-called experts are saying microservices and containers will change the way we build, maintain, operate, and integrate applications. This talk is intended for Java developers who wants to hear and see how you can develop Java microservices that are ready to run in containers. In this talk we will build a set of Java based Microservices that uses a mix of technologies with: - Spring Boot with Apache Camel - Apache Tomcat with Apache Camel You will see how we can build small discrete microservices with these Java technologies and build and deploy on the Kubernets/OpenShift3 container platform. We will discuss practices how to build distributed and fault tolerant microservices using technologies such as Kubernetes Services, Camel EIPs, Netflixx Hysterix, and Ribbon. We will use Zipkin service tracing across all four Java based microservices to provide a visualization of timings and help highlight latency problems in our mesh of microservices. And the self healing and fault tolerant aspects of the Kubernetes/OpenShift3 platform is also discussed and demoed when we let the chaos monkeys loose killing containers. This talk is a 50/50 mix between slides and demo.

Views

Total views

1,125

On Slideshare

0

From embeds

0

Number of embeds

70

Actions

Downloads

21

Shares

0

Comments

0

Likes

4

×