Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Java JMX inspection via visualvm or jconsole for a pod inside kubernetes
#to be able to view the java jmx internals of an application running in kubernetes as a pod
# set the below environment value in the pod definition
_JAVA_OPTIONS="-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.port=5000
-Dcom.sun.management.jmxremote.rmi.port=5000
-Djava.rmi.server.hostname=127.0.0.1"
#portforward
kubectl port-forward "your-app-pod" 5000
#inspect via jconsole/visualvm
jconsole localhost:5000
or visualvm -> jmx -> remotehost: localhost:5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment