'Attaching a Scala sbt process remotely to Kubernetes with IntelliJ

I have a sbt project running on Kubernetes Cluster (on Azure) and I have an endpoint for it. But I'm a newbie in scala and I want to attach sbt shell from IntelliJ to that endpoint. I tried Remote JVM Debug and gave the cluster IP from Kubernetes services to the corresponding project's code but it gives the error below:

Error running 'Debug sbt shell': Cannot connect to remote process. Host is unknown 

Command line arguments for remote JVM:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:80

Debugger mode: Attach to remote JVM Transport: Socket

The host IP and port I give is from Kubernetes' services. But It can't be seen in Ingress, instead I have the gateway for the whole project in Ingress with a DNS. It also doesnt work when I use gateway.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source