kubectl exec -it, failing to take extended commands.

3,298 views
Skip to first unread message

Joshua Sindy

unread,
Nov 18, 2016, 8:50:16 PM11/18/16
to Kubernetes developer/contributor discussion
Here is an example of the command that is not working for me.

kubectl exec -it $pod "php -f /var/www/bin/run.php" --namespace test

If shell into the container the commands works just fine.

Thanks!

Dan Lorenc

unread,
Nov 18, 2016, 8:53:43 PM11/18/16
to Joshua Sindy, Kubernetes developer/contributor discussion

I just spent a little time confused by this today. Could you try:

kubectl exec -it --namespace test $pod -- php -f /var/www/bin/run.php


--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/41111bbc-10d1-46d5-b202-4d26faef37f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jordan Liggitt

unread,
Nov 18, 2016, 8:53:50 PM11/18/16
to Joshua Sindy, Kubernetes developer/contributor discussion
I think the `--namespace test` portion needs to come before the pod name, and the rest should not be quoted as a single arg, but left as multiple args
--

Joshua Sindy

unread,
Nov 18, 2016, 10:23:11 PM11/18/16
to Dan Lorenc, Kubernetes developer/contributor discussion
That did the trick Dan, thank you!

--
Joshua Sindy

--


On Fri, Nov 18, 2016 at 8:53 PM, Dan Lorenc <dlo...@google.com> wrote:

I just spent a little time confused by this today. Could you try:

kubectl exec -it --namespace test $pod -- php -f /var/www/bin/run.php


On Fri, Nov 18, 2016, 5:50 PM Joshua Sindy <joshu...@gmail.com> wrote:
Here is an example of the command that is not working for me.

kubectl exec -it $pod "php -f /var/www/bin/run.php" --namespace test

If shell into the container the commands works just fine.

Thanks!

--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-dev+unsubscribe@googlegroups.com.

Rodrigo Campos

unread,
Nov 19, 2016, 12:30:18 PM11/19/16
to Joshua Sindy, Dan Lorenc, Kubernetes developer/contributor discussion
On Fri, Nov 18, 2016 at 10:22:29PM -0500, Joshua Sindy wrote:
> That did the trick Dan, thank you!

It's common for programs to use "--" to separate arguments of the program itself
(like kubectl in this case).

"--" is useful besides kubectl, take it into account :)
Reply all
Reply to author
Forward
0 new messages