developing microservices with apache camel, by claus ibsen
TRANSCRIPT
Claus Ibsen• Principal Software Engineer
at Red Hat
• Apache Camel8 years working with Camel
• Author of Camel in Action books
@davsclaus davsclaus
davsclaus.com
Implementation
Client Hello Service
HTTP
from timer to http
logfrom undertow
transform
hello service
Type Safe Camel Editor
Cursor is here
http://fabric8.io/guide/forge.html
Ready to run local
Client Hello Service
HTTP 8080
from timer to netty
logfrom undertow
transform
hello service
Docker Maven Plugin
Maven Project Fabric8 Maven Plugin Docker Imagebuild
https://maven.fabric8.io
Install fabric8-maven-plugin
mvn io.fabric8:fabric8-maven-plugin:3.1.63:setup
https://maven.fabric8.io
Our Demo
Client Hello Service
http://localhost:8080
from timer to http
logfrom undertow
transform
hello service
Static vs Dynamic Platform
Client Hello Service
from timer to http
logfrom undertow
transform
hello service
Hardcoded hostname and port
http://localhost:8080
Dynamic Platform
Hello Service
service ip:port
Client
from timer to http
logfrom undertow
transform
hello service
Kubernetes Service
Kubernetes Service• Network Connection to one or more Pods
• Unique static IP and port (lifetime of service)
Kubernetes Service
service ip:port
from timer to http
logfrom undertow
transform
hello service
kube proxy
Kubernetes Master
enlisted on deployment
changes
pod
node
pod
node
Kubernetes Servicefrom user point of view
service ip:port
from timer to http
logfrom undertow
transform
hello service
pod pod
Service w/ Context Path• Annotate Service with Context-Path
/say is context-path
src/main/fabric8/service.yml
Custom Service
Container Port = Inside
Service Port = Outside
Service Name
src/main/fabric8/service.yml
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 DNS is available in newer versions of Kubernetes.
Ready to run in Kubernetes
Client Hello Service
{{service:helloswarm}}
from timer to netty
logfrom undertow
transform
hello service
kube proxy
Deploy - Hello Service
Hello Service
from undertow transform
hello service
• mvn fabric8:run mvn fabric8:deploy
Running Local Kubernetes/OpenShift
• Fabric8 Maven Plugin
• MiniKube
• MiniShift
• Vagrant
• OpenShift CDK
https://fabric8.io/guide/getStarted/index.html
Running fabric8• Download gofabric8 https://github.com/fabric8io/gofabric8/releases
• Start fabric8gofabric8 start --minishift --console --memory=2000
https://fabric8.io/guide/getStarted/minishift.html
Running fabric8
mvnio.fabric8:
fabric8-maven-plugin:3.1.63: cluster-start
-Dfabric8.cluster.kind=openshift
Non Free Book
http://manning.com/ibsen2
Coupon code: camel39 gives 39% discount
Links• fabric8
• http://fabric8.io • Demo source code
• https://github.com/davsclaus/fabric8-hello • Try fabric8
• https://fabric8.io/guide/getStarted/minishift.html • Videos, blogs and more
• https://fabric8.io/community/index.html
@davsclaus davsclaus
davsclaus.com