Gle*_*eeb 7 java profiling docker kubernetes
我想在我的Kubernetes集群上描述我的播放应用程序.
我使用的是VisualVM,我采取的步骤如下:
使用以下参数运行我的播放应用程序:
"-Dcom.sun.management.jmxremote",
"-Dcom.sun.management.jmxremote.ssl=false",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.port=1098"
Run Code Online (Sandbox Code Playgroud)我的形象有 apt-get install -y visualvm
kubectl port-forward <Container> 1098
我不确定我在这里做错了什么.在localhost上运行应用程序时(不是通过IDE,直接从启动脚本运行)一切正常.
更新1,部署和服务
Run Code Online (Sandbox Code Playgroud)apiVersion: extensions/v1beta1 kind: Deployment metadata: name: myApp labels: name: myApp spec: replicas: 1 strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 0 type: RollingUpdate template: metadata: name: myApp labels: name: myApp spec: containers: - name: myApp image: ... args: ["-Dcom.sun.management.jmxremote", "-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.port=1098"] ports: - containerPort: 9000 env: ...
apiVersion: v1
kind: Service
metadata:
name: myApp
labels:
name: myApp
spec:
selector:
name: myApp
ports:
- port: 80
targetPort: 9000
Run Code Online (Sandbox Code Playgroud)
更新2 @marcospereira
文件 - >添加JMX连接 - > localhost:1098
无法连接到localhost:1098使用服务jmx:rmi ...
它可以以与下面的 QA 相同的形式执行。
多个应用程序节点如何在 kubernetes 中公开 jmx?
请设置java.rmi.server.hostname
系统属性。
"-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
Run Code Online (Sandbox Code Playgroud)
Jmx 连接到localhost:1098
.
我确认我可以连接。
归档时间: |
|
查看次数: |
1918 次 |
最近记录: |