2017-08-02 67 views
0

我要同时运行两个命令:需要运行多个命令

  1. bash
  2. service nginx start

如何传递那些通过使用下面的命令?

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 

回答

1

不确定--command标志如何工作或应该工作。

这个工作对我来说,在我得到的bash永远循环和打印“再见”运行Nginx的。 kubectl run -it testnew --image=nginx -- /bin/bash -c "service nginx start && while true; do echo bye; sleep 10;done"

而不是这个特殊的命令,你可能想创建一个在开始时运行脚本的调整图像。更容易管理正在运行的内容,更难以丢失定制内容。