How to develop your first
cloud-native Applications
with Java—
Niklas Heidloff
Developer Advocate, IBM
@nheidloff
How to use all Pieces together?
Kubernetes
Java Enterprise Edition
Istio
Eclipse MicroProfile
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
“Microservices are a software
development technique [...]
that structures an application
as a collection of loosely
coupled services.”
Wikipedia
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Continuous delivery
→ DevOps
Elasticity
→ App stays responsive
What are cloud-native Applications?
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
New Options → New Challenges
“Kubernetes (K8s) is an open-
source system for automating
deployment, scaling, and
management of containerized
applications.”
kubernetes.io
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
“Istio is an open platform for
providing a uniform way to
integrate microservices,
manage traffic flow across
microservices, enforce
policies and aggregate
telemetry data.”
github.com/istio/istio
@nheidloff
“Optimizing Enterprise Java
for a Microservices
Architecture.
[...] by innovating [...] with a
goal of standardization.”
microprofile.io
@nheidloff @Harald_U #IBMDeveloper github.com/ibm/cloud-native-starter
How to use all Pieces together?
Kubernetes
Java Enterprise Edition
Istio
Eclipse MicroProfile
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Leverage platforms as
much as possible.
Use frameworks for app
specific logic.
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Design principles
for the end-to-
end example
‘cloud-native-
starter’
Use only open-
source
components for
the core services
of the application
Make the first
time experience
as simple as
possible
Be able to run the
application in
different
environments
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Architecture: End-to-End Example ‘cloud-native-starter’
Web-App
NoSQL / Cloudant
Web-API v1 Articles
Web-API v2 Authors
Web-App
SQL / Db2
OpenID / App ID
LogDNASysdig
Authentication
Browser Kubernetes with Istio Optional Cloud Services
Ingress
@nheidloff
“A container image is a
lightweight, standalone,
executable package of
software that includes
everything needed to run an
application.”
docker.com
#IBMDeveloper github.com/ibm/cloud-native-starter
Infrastructure
Host Operating System
Container Runtime
AppA
AppB
AppC
AppD
AppE
@nheidloff
Portable Containers
Java Image
Open source stack
OpenJ9 0.14.0
OpenJDK 11.0.3+7 from AdoptOpenJDK
Open Liberty 19.0.0.5
MicroProfile 2.2
Dockerfile
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Example Application
Example Application – REST APIs
Web-App Web-API
Articles
Authors
Browser Kubernetes with Istio
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Exposing REST APIs
JAX-RS
Java API for RESTful Web Services
GetArticles.java
@nheidloff
Exposing REST APIs
Open API (formerly Swagger)
API description format for REST APIs
GetArticles.java
@nheidloff
Exposing REST APIs
Open API (formerly Swagger)
API description format for REST APIs
@nheidloff
Consuming REST APIs
MicroProfile Rest Client
Type-safe approach to invoke RESTful services
AuthorsService.java
AuthorsServiceDataAccess.java
@nheidloff
Consuming REST APIs
MicroProfile Rest Client
Type-safe approach to invoke RESTful services
AuthorsService.java
AuthorsServiceDataAccess.java
@nheidloff
Example Application – Traffic Management
Web-App
Web-API v1 Articles
Web-API v2 Authors
Browser Kubernetes with Istio
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Traffic Management – Web API Version 1
Traffic Management – Web API Version 2
Traffic Management
Example: 80% / 20% splitting
ingress.yaml
@nheidloff
Traffic Management Demo
Example Application – Resiliency
Web-App Web-API
Articles
Authors
Browser Kubernetes with Istio
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Resiliency
Authors service not available
Usage of default values
Service.java
@nheidloff
Resiliency
Articles service not available
MicroProfile fallback annotation
Service.java
@nheidloff
Resiliency Demo
Resiliency Demo
Authentication and
Authorization
OpenID Connect
Identity layer on top of the OAuth 2.0 protocol
IBM App ID
IBM service to authenticate users and protect APIs
policy.yaml
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Example Application – Authentication and Authorization
Web-App
Web-API
Articles
Authors
OpenID Connect /
IBM App ID
Authentication
Browser Kubernetes with Istio Optional Cloud Services
Ingress
@nheidloff
Authentication
Authorization
Authorization
Authorization
Via MicroProfile
server.xml
@nheidloff
Authorization
Via MicroProfile
Manage.java
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Chained invocations Kubernetes
→ 1 service = N pods
Microservices vs monolith
→ Higher complexity
→ Ephemeral
Tracing
Logging
Monitoring
Metrics
Healthchecks
Observability
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Example Application – Distributed Logging
Web-App Web-API
Articles
Authors
Browser Kubernetes with Istio
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Distributed Logging
Example Application – Distributed Logging
Web-App Web-API
Articles
Authors
Browser Kubernetes with Istio
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Distributed Logging
Tracing
OpenTracing
Vendor-neutral APIs and instrumentation for
distributed tracing
Jaeger and Zipkin
Open source distributed tracing systems
server.xml
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Distributed Tracing
Metrics
Prometheus
Monitoring system and time series database
GetArticles.java
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Metrics
Healthchecks
MicroProfile Health
Liveness probes and readiness probes
HealthEndpoint.java
Service.yaml
@nheidloff
Persistence via JPA
Web-App
Web-API Articles
Web-App
SQL / Db2
Browser Kubernetes with Istio Optional Cloud Services
Ingress
@nheidloff
Persistence
Via JPA
server.xml
@nheidloff
Persistence
Via JPA
ArticleEntity.java
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Configuration
Via MicroProfile
kubernetes.yaml
@nheidloff
Configuration
Via MicroProfile
CoreService.java
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Try out the end-to-end
microservices example
cloud-native-starter!
#IBMDeveloper github.com/ibm/cloud-native-starter@nheidloff
Documentation
IBM Cloud Kubernetes Service including Istio and Knative
IBM Developer
developer.ibm.com
IBM Cloud Lite account
ibm.biz/nheidloff
IBM loves open source
Kubernetes and Istio
OpenJ9 & AdoptOpenJDK
MicroProfile
Open Liberty
Leverage platforms as
much as possible
Use frameworks for app
specific logic
Summary
Get the code à
@nheidloff #IBMDeveloper github.com/ibm/cloud-native-starter
Jakarta Tech Talk: How to develop your first cloud-native Application with Java

Jakarta Tech Talk: How to develop your first cloud-native Application with Java