vmware-archive / kubeless

Kubernetes Native Serverless Framework
https://kubeless.io
Apache License 2.0
6.86k stars 755 forks source link

Investigate function debugging #110

Open ngtuna opened 7 years ago

ngtuna commented 7 years ago

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.

knightXun commented 6 years ago

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

andresmgot commented 6 years ago

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.

Psidium commented 5 years ago

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).