开启JMX端口
JVM参数添加JMX端口(无认证)
1 2 3 4 5 6
| -Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.port=1100 \ -Dcom.sun.management.jmxremote.rmi.port=1100 \ -Djava.rmi.server.hostname=localhost \
|
JVM参数添加JMX端口(认证)
分用户密码认证+证书认证。自己Google,我没有试。
Pod里面添加端口暴漏
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| apiVersion: apps/v1 kind: Deployment metadata: name: xxx-service spec: ··· spec: containers: ··· ports: - name: http containerPort: 20005 - name: tcp-jmx containerPort: 1100
|
port-forward 转发JMX
Pod启动之后需要在本地执行port-forward命令转发JMX服务
1 2 3 4 5 6 7 8 9 10
| ✘ liuguodong@localhost ~/work kubectl -n ${namespaces} port-forward ${podName} 1100 Forwarding from 127.0.0.1:1100 -> 1100 Forwarding from [::1]:1100 -> 1100 Handling connection for 1100 Handling connection for 1100 Handling connection for 1100 Handling connection for 1100 Handling connection for 1100 Handling connection for 1100 Handling connection for 1100
|
JVisualVm监控
需要添加jmx监控,连接localhost:1100
地址。

连接后状态
