I have to run 2 commands at a time:
bash
service nginx start
How can I pass those by using the following command?
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
Not sure how the --command
flag works or is supposed to work.
This works for me, in that I get a running nginx with bash looping forever and printing 'bye'. kubectl run -it testnew --image=nginx -- /bin/bash -c "service nginx start && while true; do echo bye; sleep 10;done"
Instead of this special command, you probably want to create a tweaked image that runs a script on start. Easier to manage what is running and harder to lose the customizations.