Chapter 6. Hands-on Cluster Management, Failover, and Load Balancing
In Chapter 5, we just had a quick introduction to cluster management, Linux containers, and cluster management. Let’s jump into using these things to solve issues with running microservices at scale. For reference, we’ll be using the microservice projects we developed in Chapters 2, 3, and 4 (Spring Boot, Dropwizard, and WildFly Swarm, respectively). The following steps can be accomplished with any of the three Java frameworks.
Getting Started
To package our microservice as a Docker image and eventually deploy it to Kubernetes, let’s navigate to our project (Spring Boot example in this case) and return to JBoss Forge. JBoss Forge has some plug-ins for making it easy to quickly add the Maven plug-ins we need to use:
$
cd
hola-springboot$
forge
Now let’s install a JBoss Forge addon:
hola-springboot]
$
addon-install\
--coordinate io.fabric8.forge:devops,2.2.148 ***SUCCESS*** Addon io.fabric8.forge:devops,2.2.148 was installed successfully.
Now let’s add the Maven plug-ins:
[
hola-springboot]
$
fabric8-setup ***SUCCESS*** Added Fabric8 Maven support with base Docker image: fabric8/java-jboss-openjdk8-jdk:1.0.10. Added the following Maven profiles[
f8-build, f8-deploy, f8-local-deploy]
to make building the project easier, e.g., mvn -Pf8-local-deploy
Let’s take a look at what the tooling did. If we open the pom.xml file, we see it added some properties:
<docker.assemblyDescriptorRef>
artifact</docker.assemblyDescriptorRef> ...
Get Microservices for Java Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.