Need to run multiple commands

25 views
Skip to first unread message

Eswari

unread,
Aug 2, 2017, 3:59:20 AM8/2/17
to Kubernetes developer/contributor discussion
Hello All,

kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>

kubectl run -it testnew --image=imagename --command -- "/bin/bash","-c","service nginx start && while true; do echo bye; sleep 10;done" --requests=cpu=200m

I have to run 2 commands at a time
1. bash
2.service nginx start
how can I pass those by using the above command

Thanks

Andy Goldstein

unread,
Aug 2, 2017, 9:17:08 AM8/2/17
to Eswari, Kubernetes user discussion and Q&A
(kubernetes-dev to bcc)

You can do it like this:

kubectl run --attach testnew --image=imagename  --requests=cpu=200m --command -- /bin/bash -c "service nginx start && while true; do echo bye; sleep 10;done"

I replaced -it with --attach because in this example you aren't passing anything in via stdin, nor do you need a TTY, but feel free to adjust as needed.

HTH,
Andy


--
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.
To post to this group, send email to kubernetes-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/6b04535c-7943-4e35-bd89-3796e07faa6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Eswari

unread,
Aug 3, 2017, 1:28:19 AM8/3/17
to Kubernetes developer/contributor discussion, tolikesw...@gmail.com, kubernet...@googlegroups.com

 Thanks Andy..
 It's working now



On Wednesday, August 2, 2017 at 6:47:08 PM UTC+5:30, Andy Goldstein wrote:
(kubernetes-dev to bcc)

You can do it like this:

kubectl run --attach testnew --image=imagename  --requests=cpu=200m --command -- /bin/bash -c "service nginx start && while true; do echo bye; sleep 10;done"

I replaced -it with --attach because in this example you aren't passing anything in via stdin, nor do you need a TTY, but feel free to adjust as needed.

HTH,
Andy

On Wed, Aug 2, 2017 at 3:59 AM, Eswari <tolikesw...@gmail.com> wrote:
Hello All,

kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>

kubectl run -it testnew --image=imagename --command -- "/bin/bash","-c","service nginx start && while true; do echo bye; sleep 10;done" --requests=cpu=200m

I have to run 2 commands at a time
1. bash
2.service nginx start
how can I pass those by using the above command

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-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages