简体   繁体   English

在Nginx反向代理后面调试Node.js微服务

[英]Debugging node.js microservices behind nginx reverse proxy

I've been struggling for a few days to get remote debugging of node.js working on Google Container Engine via Kubernetes. 我已经努力了几天,才能通过Kubernetes对在Google容器引擎上运行的node.js进行远程调试。 The main issue comes from the fact that the services that I want to debug are behind an nginx reverse proxy. 主要问题来自以下事实:我要调试的服务位于nginx反向代理后面。

So my question is, first of all, is it possible to remotely debug upstream services that lie behind a reverse proxy? 所以我的问题是,首先可以远程调试位于反向代理后面的上游服务吗? And if so, how? 如果是这样,怎么办?

If I could get debugging working through reverse proxy on localhost I'm fairly confident that I could get it working on gke through Kubernetes too. 如果我可以通过localhost上的反向代理进行调试,我很有信心也可以通过Kubernetes在gke上进行调试。

I'd be happy to supply you with any information you need, like configs etc. 我很乐意为您提供所需的任何信息,例如配置等。

Thanks! 谢谢!

I gave up trying to get debugging working through the nginx reverse proxy and instead just settled with debugging single kubernetes pods (docker droplets) through port-forwarding from the specific pod to my localhost, and then just attach the debugger to localhost:PORT 我放弃了尝试通过nginx反向代理进行调试的工作,而是仅仅通过从特定Pod到我的本地主机的端口转发来调试单个kubernetes的Pod(docker droplet),然后将调试器附加到localhost:PORT

Here's the command and documentation in case someone needs it: 如果有人需要,这里是命令和文档

kubectl port-forward POD-NAME PORT

And you get the POD-NAME by running the following command: 然后通过运行以下命令获得POD-NAME:

kubectl get pods

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM