Skip to content

Instantly share code, notes, and snippets.

@danton721
Created May 5, 2023 01:52
Show Gist options
  • Save danton721/2793af744fff303f56d78bb408ce7d88 to your computer and use it in GitHub Desktop.
Save danton721/2793af744fff303f56d78bb408ce7d88 to your computer and use it in GitHub Desktop.
Perform the following actions to debug NodeJS application running on Kubernetes without needing to start locally.

Debug Node.JS on Kubernetes directly

Perform the following actions to debug NodeJS application running on Kubernetes without needing to start locally.

1. Add this to your container

command:
  - /bin/sh
  - '-c'
args:
  - sleep 10; node --inspect index.js

2. Run below command

kubectl -n namespace port-forward container-name 9229:9229

3. Open chrome inspector, on chrome type:

chrome://inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment