Clustering in JBoss EAP is achieved using the Kubernetes discovery mechanism for
finding other JBoss EAP containers and forming a cluster. This is done by
configuring the JGroups protocol stack in standalone-openshift.xml
with
<openshift.KUBE_PING/>
elements.
For KUBE_PING
to work, the following steps must be taken:
-
The
OPENSHIFT_KUBE_PING_NAMESPACE
environment variable must be set. If not set, the server will act as if it is a single-node cluster (a "cluster of one"). -
The
OPENSHIFT_KUBE_PING_LABELS
environment variables should be set. If not set, pods outside of your application (albeit in your namespace) will try to join. -
Authorization must be granted to the service account the pod is running under to be allowed to access Kubernetes' REST api.
You have already configured the default service account to have access to Kubernetes' REST api during previous labs. Now you can scale up the mlbparks pod to two by clicking on the upper arrows on the console. Alternatively, you can use the command line to scale up the pods and form a two-member cluster.
$ oc scale dc/mlbparks --replicas=2
For pods based on Java images, the web console also exposes access to a hawt.io-based JVM console for viewing and managing any relevant Java components. A link is displayed in the pod’s details on the Applications → Pods page, provided the container has a port named jolokia. On the console, click on mlbparks pods, then on any of the two pods deployed. On the Details tab, click on Open Java Console.
In the Java Console, use the JMX browser and click on jgroups → channel → ee. The right pane shows the list of clustering JMX attributes including view which is the current state of the cluster. This attribute shows the name of two pods which are currently members of the cluster. When mlbparks pod gets scaled up or down, JBoss EAP gets notified by calling Kubernetes' REST API and updates the cluster status based on the number of pods available.