[英]How I can upgrade an new version of container in Openshift/Kubernetes
I have an openshift cluster. 我有一个openshift集群。 Docker images I store in a gitlab registry And I have a question, when I have a new image on my repo, how can I upgrade an my application in openshift? 我存储在gitlab注册表中的Docker映像我有一个问题,当我在存储库中有新映像时,如何在openshift中升级应用程序?
for example I have a deployed selenium hub with version 3.6 : 例如,我已经部署了一个版本为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: {}
and now I want to deploy a new version for example 3.7 现在我想部署一个新版本,例如3.7
The only way I know, to do it - is to change in yaml file: 我知道的唯一方法是-更改yaml文件:
from 从
image: selenium/hub:3.6
to 至
image: selenium/hub:3.7
and in console replace yaml file with new version: 并在控制台中用新版本替换yaml文件:
oc replace -f <yml_file_describing_pod>
Maybe is it a better solution to do this? 也许这样做是更好的解决方案? Or maybe pod can upgrade automatically? 也许Pod可以自动升级? And how I can do this from web? 以及如何从网络上做到这一点?
For an automatic update, you can add an ImageChange-trigger to your Deployment-Config and use selenium/hub:latest as ImageStreamTag-name. 对于自动更新,可以将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
Do you have access to your k8s cluster via kubectl? 您可以通过kubectl访问k8s集群吗? If yes, you can set the new image for your deployment and perform a rolling update: 如果是,则可以为您的部署设置新映像并执行滚动更新:
kubectl set image deployment/ds-hub ds-hub=selenium/hub:3.7
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.