- Find the pod you want to debug
kubectl get pods | grep my-awesome-api
- Give a look at the process PIDs inside this pod
Obs: You have to get the PID from the NodeJS process, it is usually the one with a command started as 'node'.
kubectl exec -it my-awesome-api -- /bin/sh -c "ps aux"
- Enable devtool in the application
Obs: You have to use the correct PID in the final of the command '...-USR1 $PID'.
kubectl exec -it my-awesome-api -- /bin/sh -c "kill -USR1 18"
- Forward debug port to your computer
kubectl port-forward my-awesome-api 9229:9229
Now you just have to open your browser and click on the debug icon on devtools page.
https://medium.com/@amirilovic/how-to-debug-node-js-applications-in-kubernetes-c169f1e88c37