Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Developing Java based microservices ready for the world of containers

963 visualizaciones

Publicado el

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.

Publicado en: Software
  • Sé el primero en comentar

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

×