OpenShift runs same container twice when it should run two different ones inside pod

不羁岁月 提交于 2019-12-25 03:34:54

问题


I want OpenShift 3.10 to create a pod (console) comprising two containers (api and console). The relevant description in the application template (under dc.spec.template.spec.containers) for DeploymentConfig console looks like this:

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 looks good to me and reports the following (the BuildConfigs for the two containers output to ImageStreamTags console:api and console:console respectively):

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

But oc describe pods --selector deploymentconfig=console reveals that the same image has been pulled twice and hence the same container runs twice inside the pod:

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"

How can I ensure that the pod indeed comprises the two distinct containers? And why is the image stream tag console:api apparently at times not referring to image 96...66 but also to 8a...02, contrary to what os describe is/console suggests?

UPDATE The mismatch is also apparent in oc describe dc/console, which indicates that both image stream tags console:api and console:console apparently have been resolved to the same container image 8a...02:

Containers:
 api:
  Image: docker-registry.default.svc:5000/registry/console@sha256:8a...02
 console:
  Image: docker-registry.default.svc:5000/registry/console@sha256:8a...02

回答1:


The following change to dc.spec.triggers seems to have resolved the situation:

- 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

Previously, there was only a single imageChangeParams for console:console. The pod now comprises the two distinct containers.



来源:https://stackoverflow.com/questions/53434624/openshift-runs-same-container-twice-when-it-should-run-two-different-ones-inside

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!