Flink Forward 2025 Barcelona: The Future of AI is Real-Time
How can I attach a profiler or look at other JMX metrics of a running Flink cluster that was deployed in Kubernetes with Ververica Platform?
Note: This section applies to Flink 1.8 or later with Ververica Platform 2.0 or later.
A Ververica Platform deployment, once started, will create a Flink cluster consisting of a JobManager (JM) pod and a few TaskManager (TM) pods. If you want to connect to these via JMX, e.g. from JConsole, VisualVM, or Mission Control, you need to allow these connections.
The simplest solution is to forward the JMX port from your Kubernetes pod to your local machine with kubectl port-forward
. This way makes it possible to debug any Java pod via JMX without having to publicly expose JMX via a Kubernetes service.
Add the following JVM options to your Deployment yaml (or set these via the UI accordingly):
spec:
template:
spec:
flinkConfiguration:
env.java.opts: >-
-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=1099
-Dcom.sun.management.jmxremote.rmi.port=1099
-Djava.rmi.server.hostname=127.0.0.1
Important:
jmxremote.port
and jmxremote.rmi.port
. This is needed to forward one port only.127.0.0.1
should be passed as the RMI server hostname. This is needed for the JMX connection to work via port-forwarding.With the <deploymentId>
from your deployment and the Kubernetes <namespace>
it is running in, you can retrieve all relevant Kubernetes pods via:
kubectl -n <namespace> get pods -l deploymentId=<deploymentId>
kubectl -n <namespace> port-forward <pod> 1099
Important: Do not redirect the port to a different local port; as JMX will verify the port and deny access.
jconsole 127.0.0.1:1099
Note: Since we have not configured SSL in this setup, you will have to allow an insecure connection.
Similarly, you can configure VisualVM, Mission Control, or the JMX tool of your choice to connect to a remote connection on 127.0.0.1:1099
.