Class KubernetesJmxConnectionProvider

java.lang.Object
org.jolokia.kubernetes.client.KubernetesJmxConnectionProvider
All Implemented Interfaces:
JMXConnectorProvider

public class KubernetesJmxConnectionProvider extends Object implements JMXConnectorProvider
This provides support for handling JMX urls over the Jolokia protocol to JVMs running in kubernetes pods Syntax examples
  • service:jmx:kubernetes:///mynamespace/mypodname-abcd-efgh/actuator/jolokia/
  • service:jmx:kubernetes:///mynamespace/mypodname-.+/actuator/jolokia/
Regular expressions in service url is supported so you can have working URLs across deploys. Regular expression URLs will connect to the first pod/service that matches expession. Prerequesite: You should have configuration and valid credentiatls for k8s cluster readily in place, so you have access to the kubernetes api. You can validate this independently with a tool such as kubectl. This jar file contains a service loader, so that Jolokia JMX protocol is supported as long as my jar (jmx-adapter-version-standalone.jar) is on the classpath
   Example:
   //NB: include trailing slash to jolokia endpoint
   JMXConnector connector = JMXConnectorFactory
             .connect(new JMXServiceURL("service:jmx:kubernetes:///mynamespace/mypodname-.+/actuator/jolokia/")));
         connector.connect();
         connector.getMBeanServerConnection();