相关疑难解决方法(0)

如何包含脚本并将其运行到kubernetes yaml中?

这是在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)

openshift openshift-origin kubernetes

3
推荐指数
2
解决办法
6893
查看次数

标签 统计

kubernetes ×1

openshift ×1

openshift-origin ×1