https://garden.io logo
#🌱|help-and-getting-started
Remote debug java application with IntelliJ IDEA in local-kubernetes
# 🌱|help-and-getting-started
h

handsome-telephone-41387

01/30/2024, 8:10 PM
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): java.io.IOException "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
c

chilly-gigabyte-83853

01/31/2024, 3:50 PM
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
Or
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.
h

handsome-telephone-41387

01/31/2024, 7:21 PM
@chilly-gigabyte-83853 that worked, thanks!
2 Views