Profiling Java application in kubernetes
It can be executed in the same form as QA below.
multiple app nodes how to expose jmx in kubernetes?
Please set java.rmi.server.hostname
System Property.
"-Dcom.sun.management.jmxremote","-Dcom.sun.management.jmxremote.ssl=false","-Dcom.sun.management.jmxremote.authenticate=false","-Dcom.sun.management.jmxremote.port=1098""-Djava.rmi.server.hostname=127.0.0.1" #add
Jmx connect to localhost:1098
.
I confirmed that I could connect.
You have to add the rmi port option too -Dcom.sun.management.jmxremote.rmi.port=1098
You need to run below command to port forward in a correct manner:
kubectl port-forward ${pod_name} 1098:1098
In visualvm, add jmx connection with localhost:1098.
Add below parameters to enable jmx connection in your java options,
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1098 -Dcom.sun.management.jmxremote.rmi.port=1098 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1