I know you can debug java microservices with Telepresence. And Scala runs on JVM, so it shouldn't be a problem right? But for some reason I couldn't manage it.
I have followed this video on youtube for a tutorial of Telepresence.
I intercepted the service I wanted to debug. It gave some errors with Kafka and mariadb(mysql). So in IntelliJ I changed their configuration according to their properties on AKS like host = "kafka.default:9092", because its namespace is default, name is kafka and port on AKS is 9092. Both Kafka and Mysql seems to be connected and currently they are not giving any errors.
In IntelliJ I am calling a Boot.scala class which reads the config and builds the project as far as I understand. When I change this service's port to 80 in local application.conf (as it is in AKS) it gives me the following error. In any other port it just listens.
I|2022-07-13 15:41:00,893|c.a.libats.http.tracing.Tracing$|Request tracing disabled in config
E|2022-07-13 15:41:01,901|akka.io.TcpListener|Bind failed for TCP channel on endpoint [/0.0.0.0:80]
And a fetch process on the website is not finished when I intercept this service with Telepresence. I have breakpoints nearly everywhere, I always debug the project and it never hits any one of them. So, what exactly is going on? Also I am open to redirections on remote debugging AKS.
PS: This project is something I inherited and I don't have any previous scala experience. So I may be missing something easy.
PS2: Also nothing changes when I leave telepresence intercept and just run it locally. Same logs, same situation with 80 port.
CodePudding user response:
Okay, it works. Just add telepresence it will intercept the pod and attach to your local application instead of the code running on the pod. So, you have to do your configuration accordingly, because it will be the code running inside the pod. Just don't use port 80 because it is reserved for HTTP even though when you "kubectl get svc -A
" it says port as 80. Just use telepresence intercept nameoftheservice
without specifying the port, it will do it instead of you and change the port accordingly in your local environment configuration.