OpenShift应该在pod内运行两个不同的容器时,会运行两次相同的容器

时间:2018-11-22 16:01:10

标签: openshift

我希望OpenShift 3.10创建一个包含两个容器(consoleapi)的容器(console)。 dc.spec.template.spec.containers DeploymentConfig的应用模板(在console下)中的相关描述如下:

containers:
- image: console:api
  imagePullPolicy: Always
  name: api
  terminationMessagePolicy: File
- image: console:console
  imagePullPolicy: Always
  name: console
  ports:
  - containerPort: 80
    protocol: TCP
  terminationMessagePolicy: File

oc describe is/console对我来说很好,并报告以下内容(两个容器的BuildConfig分别输出到ImageStreamTag的{​​{1}}和console:api中):

console:console

但是api no spec tag * docker-registry.default.svc:5000/registry/console@sha256:96...66 console no spec tag * docker-registry.default.svc:5000/registry/console@sha256:8a...02 揭示了同一张图像被拉过两次,因此同一容器在容器内运行了两次:

oc describe pods --selector deploymentconfig=console

如何确保豆荚确实包含两个不同的容器?为什么image stream tag Successfully pulled image "docker-registry.default.svc:5000/registry/console@sha256:8a...02" Successfully pulled image "docker-registry.default.svc:5000/registry/console@sha256:8a...02" 有时有时不指图像console:api,而是指96...66,这与8a...02的建议相反?

更新不匹配在os describe is/console中也很明显,这表明图像流标签oc describe dc/consoleconsole:api显然已经被解析为相同的容器图像console:console

8a...02

1 个答案:

答案 0 :(得分:1)

以下对dc.spec.triggers的更改似乎已经解决了这种情况:

- type: ConfigChange
- imageChangeParams:
    automatic: true
    containerNames:
    - api
    from:
      kind: ImageStreamTag
      name: console:api
      namespace: registry
  type: ImageChange
- imageChangeParams:
    automatic: true
    containerNames:
    - console
    from:
      kind: ImageStreamTag
      name: console:console
      namespace: registry
  type: ImageChange

以前,imageChangeParams只有一个console:console。吊舱现在包含两个不同的容器。