Remote debug java application with IntelliJ IDEA i...
# 🌱|help-and-getting-started
Hi, does anyone has an example of Deploy container configuration to set up remote debug for java application? Also is it possible to create multiple ingresses for different ports, for example myhost/path, myhost:5005/path as application needs to accept API requests on one port and debugger should work through another. I tried a workaround to add another ingress with another hostname for debugger but it returns an error Unable to open debugger port (myhost:80): "handshake failed - unrecognized message from target VM" Configuration: --- kind: Deploy name: my-service type: container build: my-service spec: env: JAVA_TOOL_OPTIONS: "-Xdebug -agentlib:jdwp=transport=dt_socket,address=*:5005,server=y,suspend=n" ports: - name: http protocol: TCP containerPort: 9306 servicePort: 9306 localPort: 9306 - name: debug containerPort: 5005 servicePort: 5006 localPort: 5006 ingresses: - port: http hostname: myhost path: /path - port: debug hostname: debug.myhost
Hi Alex, unless you need the debugger port to be exposed outside the cluster you don't need to create a new ingress. The example you showed should work but you might need to deploy either with:
Copy code
garden deploy --forward
Copy code
garden deploy --sync
(which implicitly starts port-forwarding). Honestly the docs are not very discoverable when it comes to port-forwarding and we have been wanting to write a guide to help folks with remote debugging for a while. Let me know if this helps.
@chilly-gigabyte-83853 that worked, thanks!