我有一个openshift集群。
我存储在gitlab注册表中的Docker镜像
我有一个问题,当我在存储库中有新镜像时,如何在openshift中升级应用程序?
例如,我已经部署了一个版本为3.6的Selenium Hub:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose-debug.yml
kompose.version: 1.6.0 (e4adfef)
creationTimestamp: null
labels:
io.kompose.service: ds-hub
name: ds-hub
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: ds-hub
spec:
containers:
- env:
- name: GRID_CLEAN_UP_CYCLE
value: "10000"
- name: GRID_MAX_SESSION
value: "10"
- name: GRID_TIMEOUT
value: "150"
image: selenium/hub:3.6
name: ds-hub
ports:
- containerPort: 4444
resources: {}
stdin: true
tty: true
restartPolicy: Always
status: {}
现在我想部署一个新版本,例如3.7
我知道的唯一方法是-更改yaml文件:
从
image: selenium/hub:3.6
至
image: selenium/hub:3.7
并在控制台中用新版本替换yaml文件:
oc replace -f <yml_file_describing_pod>
也许这样做是更好的解决方案?也许Pod可以自动升级?以及如何从网络上做到这一点?
最佳答案
对于自动更新,可以将ImageChange-trigger添加到Deployment-Config中,并使用selenium / hub:latest作为ImageStreamTag-name。
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
from:
kind: ImageStreamTag
name: selenium/hub:latest
containerNames:
- ds-hub
关于docker - 如何在Openshift/Kubernetes中升级容器的新版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48169755/