Created
July 4, 2023 09:50
-
-
Save tuxfight3r/169867c001684411814e5f8456f4a6ed to your computer and use it in GitHub Desktop.
Java JMX inspection via visualvm or jconsole for a pod inside kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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