Only ls works
rajeevb2 opened this issue · 6 comments
@rmohr
Thanks for implementing custom-exec. I was able to get this to work. However only ls works. I was unable to get cat of a file or even /bin/bash to work. Can you fix this to make cat and /bin/bash work? That will be tremendously useful.
@rajeevb2 I really only meant this as a demo, so that others can integrate their own stuff, follwing this pattern. Are you trying to use the websocket connection inside your own go code, or is there any other reason why you can't use kubectl exec?
@rmohr
I can use kubectl exec. I thought with client-go and your code I can add an extra level of security.
I think if you added support to stdin/stdout you will be close to kubectl exec. Until then I will use kubectl exec
@rajeevb2 Oh, I guess there is a misunderstanding. kubectl is definitely as secure as this one. I just wanted to show, how you can create your own kubectl-like client for websockets (since the websocket part is not yet part of the client-go SDK).
@rmohr
Sorry I wasnt clear. I am hoping to add additional security on top of your code -- more than kubectl. I understand your websocket rationale for creating the code.
@rajeevb2 feel free to take the code and change it to your needs. I really don't want to make more out of this, than just a demo. In order to make it also work for interactive sessions, you would have to pass a query to the apiserver, which looks like this:
POST http://localhost:8189/api/v1/namespaces/default/pods/testpod/exec?command=%2Fbin%2Fbash&container=libvirtd&container=libvirtd&stdin=true&stdout=true&tty=true