Kubernetes Java 远程 Debug 添加配置
Debug Kubernetes Java About 497 wordsDeployment 配置
containers.env
下添加环境变量JDK_JAVA_OPTIONS
。重启Deployment
。
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-service
namespace: my-ns
spec:
replicas: 1
template:
spec:
containers:
- env:
- name: JDK_JAVA_OPTIONS
value: >-
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
端口转发
kubectl port-forward pod-name 5005:5005
环境变量区别
Java 11
使用JDK_JAVA_OPTIONS
,Java 8
使用JAVA_OPTIONS
(较新版本也兼容JDK_JAVA_OPTIONS
)
Views: 524 · Posted: 2024-07-29
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...