JAVAEE8 / kubernetes – High availability

Replicating the session
Created by: Evandro Moura 06.19.2021, 23:00 pm

App Java web (javaee8) with Wildfly, PostgreSQL and Docker.

Running on Kubernetes and replicating the session between instances using Kube Ping.


Clone the project repository:

git clone

Settings: kubernetes/standalone-full-ha.xml


Configure according to your PostgreSQL connection data


Configure the Host correctly

If you need to register the host on your machine:

echo "192.168.xx.xx" >> /etc/hosts

Enter the IP of Kubernetes – NGINX – IngressController

Understanding the Dockerfile file

When generating the Docker build, it will copy the KUBE PING module files, the standalone-full-ha.xml file (with the datasource and host information) and the build to the corresponding wildfly directories.

Also, it will set the docker ENTRYPOINT to

Docker build creation and upload to Docker Hub


mvn clean package && sudo docker build -t evandromoura/jkubecluster . && sudo docker push evandromoura/jkubecluster

Change the command above informing your repository on the docker hub

Configuration of Kubernetes components

Prerequisites: Have Kubernetes and NGINX Ingress Controller installed:


Jgroups / Cluster Role




Applying the jkubecluster-app.yaml file

Run this configuration on the master

kubectl apply -f jkubecluster-app.yaml

Running and testing session replication

3 replicas of our container were created.

Let's stop POD jkubecluster-evandromoura-97d578665-wb5j8

Refreshing the page will redirect it to another POD and keep the session values