Playing with Java Microservices on Kubernetes and OpenShift
Playing with Java Microservices on Kubernetes and OpenShift
About the Book
Playing with Java Microservices on Kubernetes and OpenShift will teach you how to build and design microservices using Java and the Spring platform.
This book covers topics related to creating Java microservices and deploy them to Kubernetes and OpenShift.
Traditionally, Java developers have been used to developing large, complex monolithic applications. The experience of developing and deploying monoliths has been always slow and painful. This book will help Java developers to quickly get started with the features and the concerns of the microservices architecture. It will introduce Docker, Kubernetes and OpenShift to help them deploying their microservices.
The book is written for Java developers who wants to build microservices using the Spring Boot/Cloud stack and who wants to deploy them to Kubernetes and OpenShift.
You will be guided on how to install the appropriate tools to work properly. For those who are new to Enterprise Development using Spring Boot, you will be introduced to its core principles and main features thru a deep step-by-step tutorial on many components. For experts, this book offers some recipes that illustrate how to split monoliths and implement microservices and deploy them as containers to Kubernetes and OpenShift.
The following are some of the key challenges that we will address in this book:
- Introducing Spring Boot/Cloud for beginners
- Splitting a monolith using the Domain Driven Design approach
- Implementing the cloud & microservices patterns
- Rethinking the deployment process
- Introducing containerization, Docker, Kubernetes and OpenShift
By the end of reading this book, you will have practical hands-on experience of building microservices using Spring Boot/Cloud and you will master deploying them as containers to Kubernetes and OpenShift.
Packages
The Book
English
PDF
EPUB
MOBI
WEB
The Book + 1 Hour Training
This package contains the book with a one hour of live assistance & training using Skype or Zoom or any video chat solution you choose.
English
PDF
EPUB
MOBI
WEB
Reader Testimonials

Mondher Saadaoui
Senior Java & Cloud Architect
Very comprehensive book, discusses the evolution of architectures in a clear and precise manner, with concrete examples. Very useful for mastering microservice architectures.

Julien Dubois
Azure developer advocate at Microsoft - Lead developer of JHipster
Many thanks to @NebrassLamouchi for his "Playing with Java Microservices on Kubernetes" book, this is exactly what I need at the moment!

Rached Jouida
Red Hat Cloud Consultant
Bouquin complet et explicite reflétant une bonne connaissance des best-practices pour développer sur Kubernetes et OpenShift.

Semah Mhamdi
Java & Cloud Developer at Onepoint
This book was definitely worth the read. If you want to master how to break monolith to microservices and orchestration at a deep level, get and read this book. I liked the idea of explaining concepts by providing sample examples. The topics so far written/explained in this book does not require deep prior knowledge.
Table of Contents
-
- Acknowledgements
-
Preface
- What this book covers
-
Part One: The Monolithics Era
-
Chapter 1: Introduction to the Monolithic architecture
- Introduction to an actual situation
- Presenting the context
- How to solve these issues ?
-
Chapter 2: Coding the Monolithic application
-
Presenting our domain
- Use Case Diagram
- Class Diagram
- Sequence Diagram
-
Coding the application
-
Presenting the technology stack
- Java 8
- Maven
- Spring Boot
- NetBeans IDE
-
Implementing the Boutique
- Generating the project skull
-
Creating the Persistence Layer
- Cart
- CartStatus
- Address
- Category
- Customer
- Order
- OrderItem
- Payment
- Product
- ProductStatus
- Review
-
Creating the Service Layer
- Typical Service: CartService
- AddressService
- CategoryService
- CustomerService
- OrderItemService
- OrderService
- PaymentService
- Product Service
- ReviewService
-
Creating the Web Layer
- Typical RestController: CartResource
- CategoryResource
- CustomerResource
- OrderItemResource
- OrderResource
- PaymentResource
- ProductResource
- ReviewResource
-
Automated API documentation
- Maven Dependencies
- Java Configuration
- Hello World Swagger !
-
Presenting the technology stack
-
Presenting our domain
-
Chapter 3 : Upgrading the Monolithic application
- Refactoring the database
-
Chapter 4: Building & Deploying the Monolithic application
-
Building the monolith
- Which package type: WAR vs JAR
- Build a JAR
-
Build WAR if you
- Step 1: Adding the Servlet Initializer Class
- Step 2: Exclude the embedded container from the WAR
-
Step 3: Change the package type to war in
pom.xml
- Step 4: Package your application
-
Deploying the monolith
- Deploying the JAR
- Deploying the WAR
-
Building the monolith
-
Chapter 1: Introduction to the Monolithic architecture
-
Part Two: The Microservices Era
-
Chapter 5: Microservices Architecture Pattern
-
The Monolithic Architecture
- What is a Monolithic Architecture ?
-
Microservices Architecture
- What is a Microservices Architecture ?
- What is really a Microservice?
- Making the Switch
-
The Monolithic Architecture
-
Chapter 6: Splitting the Monolith: Bombarding the domain
-
What is Domain-Driven Design ?
- Context
- Domain
- Model
- Ubiquitous Language
-
Strategic Design
- Bounded context
-
Bombarding La Boutique
- Codebase
- Dependencies and Commons
-
Entities
- Example: Breaking Foreign Key Relationships
-
Refactoring Databases
- Staging the Break
-
Transactional Boundaries
- Try Again Later
- Abort the Entire Operation
- Distributed Transactions
- So What to Do?
- Summary
-
What is Domain-Driven Design ?
-
Chapter 7: Applying DDD to the code
- Introduction
-
Applying Bounded Contexts to Java Packages
- The birth of the commons package
- The birth of the configuration package
-
Locating & breaking the BC Relationships
- Locating the BC Relationships
- Breaking the BC Relationships
-
Chapter 8: Meeting the microservices concerns and patterns
- Introduction
-
Cloud Patterns
- Service discovery and registration
- Externalized configuration
- Circuit Breaker
- Database per service
- API gateway
- CQRS
- Event sourcing
- Log aggregation
- Distributed tracing
- Audit logging
- Application metrics
- Health check API
- Security between services: Access Token
- What’s next?
-
Chapter 9: Implementing the patterns
- Introduction
-
Externalized configuration
- Step 1: Generating the Config Server project skull
- Step 2: Defining the properties of the Config Server
- Step 3: Creating a centralized configuration
- Step 4: Enabling the Config Server engine
- Step 5: Run it !
- Step 6: Spring Cloud Config Client
-
Service Discovery and Registration
- Step 1: Generating the Eureka Server project skull
- Step 2: Defining the properties of the Eureka Server
- Step 3: Creating the main configuration of the Eureka Server
- Step 4: Enabling the Eureka Server engine
- Step 5: Update the global application.yml of the Config Server
- Step 6: Run it !
- Step 7: Client Side Load Balancer with Ribbon
-
Distributed tracing
- Step 1: Getting the Zipkin Server
-
Step 2: Listing the dependencies to add to our microservices
- Sleuth
- Zipkin Client
- Health check API
-
Circuit Breaker
- Step 1: Add the Maven dependency to your project
- Step 2: Enable the circuit beaker
- Step 3: Apply timeout and fallback method
- Step 4: Enable the Hystrix Stream in the Actuator Endpoint
- Step 5: Monitoring Circuit Breakers using Hystrix Dashboard
-
API Gateway
- Step 1: Generating the API Gateway project skull
- Step 2: Enable the Zuul Capabilities
- Step 3: Defining the route rules
- Step 4: Enabling API specification on gateway using Swagger2
- Step 5: Run it!
-
Log aggregation and analysis
- Step 1: Installing Elasticsearch
- Step 2: Installing Kibana
-
Step 3: Installing & Configuring Logstash
- Installing Logstash
- Configuring Logstash
- Run it !
-
Step 4: Enabling the Logback features
- Adding Logback libraries to our microservices
- Adding Logback configuration file to our microservices
- Step 5: Adding the Logstash properties to the Config Server
- Step 6: Attending the Kibana party
- Conclusion
-
Chapter 10: Building the standalone microservices
- Introduction
- Global Architecture Big Picture
-
Implementing the µServices
-
Before starting
- Step 1: Generating the Commons project skull
- Step 2: Moving Code from our monolith
- Step 3: Moving Code from our monolith
- Step 4: Building the project
-
The Product Service
- Step 1: Generating the Product Service project skull
- Step 2: Swagger 2
- Step 3: Application Configuration
- Step 4: Logback
- Step 5: Activating the Circuit Beaker capability
- Step 6: Moving Code from our monolith
-
The Order Service
- Step 1: Generating the Order Service project skull
- Step 2: Swagger 2
- Step 3: Application Configuration
- Step 4: Logback
- Step 5: Activating the Circuit Beaker capability
- Step 6: Moving Code from our monolith
-
The Customer Service
- Step 1: Generating the Customer Service project skull
- Step 2: Swagger 2
- Step 3: Application Configuration
- Step 4: Logback
- Step 5: Activating the Circuit Beaker capability
- Step 6: Moving Code from our monolith
-
Before starting
- Conclusion
-
Chapter 5: Microservices Architecture Pattern
-
Part Three: Containers & Cloud Era
-
Chapter 11. Getting started with Docker
- Introduction to containerization
-
Introducing Docker
- What is Docker ?
- Images and containers
-
Installation and first hands-on
- Installation
- Run your first container
-
Docker Architecture
- The Docker daemon
- The Docker client
- Docker registries
-
Docker objects
- Images
- Containers
- Docker Machine
-
Why should I use it?
- Using Docker on older machines
- Provision remote Docker instances
-
Diving into Docker Containers
- Introduction
- Your new development environment
-
Define a container with Dockerfile
-
Create sample application
- Run the app
- Share your image
-
Log in with your Docker ID
- Automating the Docker image build
-
Create sample application
-
Meeting the Docker Services
- Your first docker-compose.yml file
- Run your new load-balanced app
- Scale the app
- Remove the app and the swarm
- Containerizing our microservices
-
Chapter 12. Getting started with Kubernetes
-
What is Kubernetes ?
- Kubernetes Architecture
-
Kubernetes Core Concepts
- Kubectl
- Cluster
- Namespace
- Label
- Annotation
- Selector
- Pod
- ReplicationController
- ReplicaSet
- Deployment
- StatefulSet
- DaemonSet
- Service
- Ingress
- Volume
- PersistentVolume
- PersistentVolumeClaim
- StorageClass
- Job
- CronJob
- ConfigMap
- Secret
- Run Kubernetes locally
-
What is Kubernetes ?
-
Chapter 13: The Kubernetes style
-
Discovering the Kubernetes style
- Create the ConfigMap
- Create the Secret
- Deploy PostgreSQL to Kubernetes
- What is Spring Cloud Kubernetes
- Deploy it to Kubernetes
- It works ! Hakuna Matata !
-
Revisiting our Cloud Patterns after meeting Kubernetes
-
Service Discovery and Registration
-
Engaging the Kubernetes-enabled Discovery library
- Step 1: Remove the Eureka Client dependency
- Step 2: Add the Kubernetes-enabled Discovery library
- Step 3: Defining the Kubernetes Service name:
-
Engaging the Kubernetes-enabled Discovery library
-
Load Balancing
- Server Side Load Balancing
- Client Side Load Balancing
-
Externalized Configuration
-
Replacing the Config Server by ConfigMaps
- Step 1: Removing the Spring Cloud Config footprints
- Step 2: Adding the Maven Dependencies
- Step 3: Creating ConfigMaps based on the Application properties files
- Step 4: Authorizing the ServiceAccount access to ConfigMaps
- Step 5: Boosting Spring Cloud Kubernetes Config
-
Replacing the Config Server by ConfigMaps
-
Log aggregation
- Step 1: Prepare the Minikube
-
Step 2: Install EFK using Helm
- Step 2.1: Prepare Helm
- Step 2.2: Add the Chart repository
- Step 3: Installing the Elasticsearch Operator
- Step 4: Installing the EFK Stack using Helm
- Step 5: Remove the broadcasting appenders
- Health check API
-
API Gateway
- Step 1: Delete the old ApiGateway microservice
- Step 2: Create the ApiGateway Ingress
-
Distributed Tracing
- Step 1: Deploy Zipkin to Kubernetes
- Step 2: Forward Sleth traces to Zipkin
-
Service Discovery and Registration
-
Discovering the Kubernetes style
-
Chapter 14: Getting started with OpenShift
- Introduction
-
What is really OpenShift ?
- Run OpenShift locally
- Free OpenShift cluster
-
What is the difference between OpenShift & Kubernetes
- The OpenShift Web Console
- Integrated Container Registry & ImageStreams
- Native CI/CD factory
- Logging and monitoring
- Version Control Integration
- Security
-
What is changing in OpenShift?
- Common Kubernetes and OpenShift resources
- OpenShift specific resources
-
Chapter 15: The Openshift style
- Introduction
-
What is the OpenShift style?
- Route instead of Ingress
- Building applications
-
Continuous Integration & Deployment
-
OpenShift Pipelines
- OpenShift Jenkins Client Plug-in
- OpenShift DSL
- Jenkins Pipeline Strategy
- Jenkinsfile
-
Jenkins
- Using the Jenkins Kubernetes Plug-in to Run Jobs
- OpenShift Container Platform Pipeline Plug-in
- OpenShift Container Platform Client Plug-in
- OpenShift Container Platform Sync Plug-in
-
OpenShift Pipelines
-
Conclusion
- Does it worth to move from OpenShift ?
- When do I need OpenShift ?
- Is OpenShift really matters ?
- Can I do the job using Kubernetes ?
-
Chapter 11. Getting started with Docker
-
Part four: Conclusion
-
Chapter 16: Conclusion
- Development
- Fabric8 Maven Plugin
- Deployment
- End of the End
-
Chapter 16: Conclusion
-
Part five: Bonus Chapters
-
Service Mesh
- Introduction
- What is a Service Mesh ?
- Why do we need Service Mesh ?
- Conclusion
-
Bonus 1: Service Mesh: Istio
-
What is Istio?
- Istio Architecture
-
Istio Components
- Envoy
- Mixer
- Pilot
- Citadel
- Galley
-
Getting started with Istio
- Requirements
- Get & Install Istio
-
Envoy Sidecar Injection
- Automatic Sidecar Injection
- Manual Sidecar Injection
-
Traffic Management
- Istio Gateway & VirtualService
- Destination Rules
-
Observability
-
Distributed Tracing
- Hello Jaeger
- Trace sampling
- Grafana
- Prometheus
- Service Graph
-
Distributed Tracing
- Conclusion
-
What is Istio?
- Bonus 2: Service Mesh: Linkerd
-
Service Mesh
Authors have earned$9,886,858writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Learn more about writing on Leanpub
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Top Books
C++ Best Practices
Jason TurnerLevel up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
Functional Design and Architecture
Alexander GraninSoftware Design in Functional Programming, Design Patterns and Practices, Methodologies and Application Architectures. How to build real software in Haskell with less efforts and low risks. The first complete source of knowledge.
Atomic Kotlin
Bruce Eckel and Svetlana IsakovaFor both beginning and experienced programmers! From the author of the multi-award-winning Thinking in C++ and Thinking in Java together with a member of the Kotlin language team comes a book that breaks the concepts into small, easy-to-digest "atoms," along with exercises supported by hints and solutions directly inside IntelliJ IDEA!
R Programming for Data Science
Roger D. PengThis book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
I am a Software Engineer and I am in Charge
Alexis Monville and Michael DoyleI am a Software Engineer and I am in Charge is a real-world, practical book that helps you increase your impact and satisfaction at work no matter who you work with.
In the book, we will follow Sandrine, a fictional character who learns to think in a new way enabling her to take a different course of action.
C++20
Rainer GrimmC++20 is the next big C++ standard after C++11. As C++11 did it, C++20 changes the way we program modern C++. This change is, in particular, due to the big four of C++20: ranges, coroutines, concepts, and modules.
Invest In Digital Health - The Medical Futurist's Guide
Dr. Bertalan MeskoArtificial Intelligence and Digital Health are booming. In this book, we explain why now it's a good time to invest in Digital Health and give recommendations on where to invest by looking at the top 24 technological trends we find the most promising.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
The Hundred-Page Machine Learning Book
Andriy BurkovEverything you really need to know in Machine Learning in a hundred pages.
Top Bundles
- #1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #3
The Future of Digital Health
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy and how technology giants such as Amazon or Google want to conquer... - #4
Cisco CCNA 200-301 Complet
4 Books
Ce lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301. - #5
Modern Management Made Easy
3 Books
Read all three Modern Management Made Easy books. Learn to manage yourself, lead and serve others, and lead the organization. - #6
CCDE Practical Studies (All labs)
3 Books
CCDE lab - #7
Modern C++ by Nicolai Josuttis
2 Books
- #8
"The C++ Standard Library" and "Concurrency with Modern C++"
2 Books
Get my books "The C++ Standard Library" and "Concurrency with Modern C++" in a bundle. The first book gives you the details you should know about the C++ standard library; the second one dives deeper into concurrency with modern C++. In sum, you get more than 600 pages full of modern C++ and about 250 source files presenting the standard library... - #9
Linux Administration Complet
4 Books
Ce lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité... - #10
Advanced Product Management
3 Books
Get The Art of Strategy, Product Discovery and Lean Product Management with a 20% discount.