kubeless icon indicating copy to clipboard operation
kubeless copied to clipboard

Investigate function debugging

Open ngtuna opened this issue 7 years ago • 3 comments

Not sure how we can do it but just raise the issue first. Google Cloud Function supports it at some specific languages like nodejs for example: https://cloud.google.com/functions/docs/monitoring/debugging

Their provided local emulator has:

$ functions debug --help
$ functions inspect --help

https://cloud.google.com/functions/docs/emulator

Turning to AWS Lambda they don't have it yet.

ngtuna avatar Mar 28 '17 10:03 ngtuna

is functions inspect like docker inspect or kubectl logs pod? implement functions debug may be hard.

knightXun avatar May 10 '18 17:05 knightXun

It is not clear, I think we don't need an inspect command since the information is already available when doing kubectl get function -o yaml. About the debug options I am not sure either, I would suggest to run the function as a local docker container but that is almost the same than running the function in minikube.

andresmgot avatar May 11 '18 07:05 andresmgot

What if there was a new nodejs${version}-debug runtime?

By creating a Dockerfile based on https://github.com/kubeless/runtimes/blob/master/stable/nodejs/Dockerfile.8 the CMD could be changed from CMD ["node", "kubeless.js"] to CMD ["node", "--inspect", "kubeless.js"]. After the function pod starts, one could use ssh -L to tunnel a port from the pod to the localhost machine. After this, it is just a matter of pointing a local debugger (Chrome dev tools, visual code, etc) to this tunneled port.

Can we create an ssh tunnel with kubectl? Maybe we'd have to install openssh-server on the pod that runs the node to enable a tunnel.

What do you think? When the user wants to debug a function, all that the user have to do is change the runtime and redeploy the functions, as the tunneling could be done by kubeless cli (I don't know).

Psidium avatar Oct 31 '19 14:10 Psidium