With the advancement of the dockerization of applications, Kubernetes has become a standard in the market, but we must remember that there are still thousands of legacy applications that depend on certain features provided by the application servers. So, if you need to use session replication, you will surely need Wildfly instances to be clustered. To solve this smoothly, you can use the “Kubernetes discovery protocol for JGroups” aka “KUBE-PING”. KUBE_PING is a discovery protocol for JGroups cluster nodes managed by Kubernetes: jgroups-kubernetes.
I assume you already have a Kubernetes cluster, so let’s just focus on WildFly settings.
The first step is to create a repository that will contain all our files:
Shell
1[root@workstation ~]# mkdir wildfly20-kubeping
2[root@workstation ~]# mkdir -p wildfly20-kubeping/application
3[root@workstation ~]# mkdir -p wildfly20-kubeping/configuration
4[root@workstation ~]# mkdir -p wildfly20-kubeping/kubernetes
Then create a Dockerfile with the necessary steps for image customization:
Dockerfile
1[root@workstation ~]# vi wildfly20-kubeping/Dockerfile
2FROM jboss/wildfly:20.0.0.Final
3
4LABEL MAINTAINER Mauricio Magnani <msmagnanijr@gmail.com>
5
6RUN /opt/jboss/wildfly/bin/add-user.sh admin redhat --silent
7
8ADD configuration/config-server.cli /opt/jboss/
9
10RUN /opt/jboss/wildfly/bin/jboss-cli.sh --file=config-server.cli
11
12RUN rm -Rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history/*
13
14ADD application/cluster.war /opt/jboss/wildfly/standalone/deployments/
15
16EXPOSE 8080 9990 7600 8888
#java #tutorial #kubernetes #wildfly #session replication #kube_ping