【发布时间】:2019-10-26 21:39:01
【问题描述】:
我想出了如何在 openshift 中运行一次性作业(替代 docker run):
oc run my-job --replicas=1 --restart=Never --rm -ti --command /bin/true --image busybox
如何将 configmap 挂载到作业容器中?
【问题讨论】:
标签: kubernetes openshift
我想出了如何在 openshift 中运行一次性作业(替代 docker run):
oc run my-job --replicas=1 --restart=Never --rm -ti --command /bin/true --image busybox
如何将 configmap 挂载到作业容器中?
【问题讨论】:
标签: kubernetes openshift
您可以使用--overrides 标志:
oc run my-job --overrides='
{
"apiVersion": "v1",
"kind": "Pod",
"spec": {
"containers": [
{
"image": "busybox",
"name": "mypod",
"volumeMounts": [
{
"mountPath": "/path",
"name": "configmap"
}
]
}
],
"volumes": [
{
"configMap": {
"name": "myconfigmap"
},
"name": "configmap"
}
]
}
}
' --replicas=1 --restart=Never --rm -ti --command /bin/true --image busybox
【讨论】: