Replies: 3 comments 5 replies
-
Beta Was this translation helpful? Give feedback.
-
Same issue here, @andrewazores can you elaborate with this? |
Beta Was this translation helpful? Give feedback.
-
TL;DR Setting java.rmi.server.hostname={service}.{namespace}.svc.cluster.local works, allowing it to be mapped locally for JDK Mission Control with port-forwarding as well as works in Cryostat. I was experimenting to determine which hostname (or port) RMI defaults to when java.rmi.server.hostname is not explicitly set. It seems that it defaults to the pod's hostname and address. However, I also tried setting java.rmi.server.hostname={service}.{namespace}.svc.cluster.local, and it actually worked! In both cases, InetAddress.getLocalHost().getHostName(), InetAddress.getLocalHost().getCanonicalHostName(), and InetAddress.getLocalHost().getHostAddress() returned the same values, so I believe setting java.rmi.server.hostname={service}.{namespace}.svc.cluster.local is a viable option. This allows you to set this hostname in the local "hosts" file to 127.0.0.1 and specify {service}.{namespace}.svc.cluster.local:9091 to use JDK Mission Control with a port-forwarded app. |
Beta Was this translation helpful? Give feedback.
-
I am experimenting with having both options working:
JVM options for those to work are:
-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9091 -Dcom.sun.management.jmxremote.rmi.port=9091 -Djava.rmi.server.hostname=127.0.0.1
came across this in https://iceburn.medium.com/how-to-expose-jmx-in-kubernetes-b1faad450451-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9091 -Dcom.sun.management.jmxremote.rmi.port=9091
What is important, adding
-Djava.rmi.server.hostname=127.0.0.1
to target JVM make it work with port-forward, but then cryostat stops working - it throwns bunch ofconnection exception
in the logs and is unable to connect/start recording/create JVM identifier`.I am still experimenting to make both options working, but if anyone has encountered something similar I would appreciate any hints.
Beta Was this translation helpful? Give feedback.
All reactions