Playing with Java Microservices on Kubernetes and OpenShift
With Membership
Minimum paid price

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.

About the Author

Nebrass Lamouchi
Nebrass Lamouchi

Nebrass Lamouchi is a senior software engineer at Microsoft who is addicted to Java and cloud technologies. He is also a former NetBeans Dream Team member. Nebrass was one of the four happy winners of the Oracle Groundbreaker Awards in May, 2019. ?

He has also been a project leader on the Barbarus Project for the OWASP Foundation since March, 2013.

He is the author of the books

Nebrass graduated with an M.Sc Degree in Information Systems Security and a Bachelor’s Degree in Computing Sciences and Management from the Higher Institute of Management of Tunis, Tunisia.

Over the past night years, he has worked on Java SE/EE projects in many sectors, including business management, petroleum, finance and banking, medical and healthcare, and defense and space. He has developed applications using many frameworks and Java-related technologies, such as native Java EE APIs and third-party frameworks and tools (Spring, Quarkus, Hibernate, Primefaces, JBoss Forge). He has managed and used infrastructure and programming tools such as DBMS, Java EE servers (Glassfish and JBoss), quality and continuous integration/deployment tools (Sonar, Jenkins, and Azure DevOps), and Docker, Kubernetes, and OpenShift.


The Book
  • PDF

  • EPUB

  • WEB

  • English

With Membership
Minimum paid price
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.

  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price

Reader Testimonials

Mondher Saadaoui
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
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
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
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 !
    • 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
  • 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
    • 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
    • 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
      • Conclusion
  • 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
      • 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
    • 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:
        • 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
        • 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
    • 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
      • Conclusion
        • Does it worth to move from OpenShift ?
        • When do I need OpenShift ?
        • Is OpenShift really matters ?
        • Can I do the job using Kubernetes ?
  • Part four: Conclusion
    • Chapter 16: Conclusion
      • Development
      • Fabric8 Maven Plugin
      • Deployment
      • End of the End
  • 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
      • Conclusion
    • Bonus 2: Service Mesh: Linkerd

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

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) and EPUB (for phones, tablets and 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

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub