这是在kubernetes yaml(helloworld.yaml)中运行简单批处理的方法:
...
image: "ubuntu:14.04"
command: ["/bin/echo", "hello", "world"]
...
Run Code Online (Sandbox Code Playgroud)
在Kubernetes中,我可以这样部署:
$ kubectl create -f helloworld.yaml
Run Code Online (Sandbox Code Playgroud)
假设我有一个这样的批处理脚本(script.sh):
#!/bin/bash
echo "Please wait....";
sleep 5
Run Code Online (Sandbox Code Playgroud)
有没有办法将script.sh包含进去,kubectl create -f以便它可以运行脚本。现在假设helloworld.yaml像这样编辑:
...
image: "ubuntu:14.04"
command: ["/bin/bash", "./script.sh"]
...
Run Code Online (Sandbox Code Playgroud)