OpenShift应该在Pod中运行两个不同的容器时运行两次相同的容器 [英] OpenShift runs same container twice when it should run two different ones inside pod

查看:409
本文介绍了OpenShift应该在Pod中运行两个不同的容器时运行两次相同的容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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对我来说不错,并报告以下内容(两个容器的BuildConfig s分别输出到ImageStreamTag s console:apiconsole:console):

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

但是oc describe pods --selector deploymentconfig=console揭示相同的图像已被拉过两次,因此同一容器在容器内运行了两次:

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"

如何确保豆荚确实包含两个不同的容器?以及为什么图像流标记 console:api显然有时不是指图像96...66而是指8a...02,这与os describe is/console的建议相反?

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?

更新不匹配在oc describe dc/console中也很明显,这表明图像流标签console:apiconsole:console显然已被解析为相同的容器图像8a...02:

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

推荐答案

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

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

以前,console:console只有一个imageChangeParams.吊舱现在由两个不同的容器组成.

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

这篇关于OpenShift应该在Pod中运行两个不同的容器时运行两次相同的容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆