【问题标题】:How to run once an openshift job with configmap如何使用 configmap 运行一次 openshift 作业
【发布时间】: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


    【解决方案1】:

    您可以使用--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
    

    【讨论】:

      猜你喜欢
      • 2018-03-22
      • 2017-02-15
      • 1970-01-01
      • 2011-02-12
      • 1970-01-01
      • 2014-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多