如何保持新旧部署(Kubernetes / Openshift)

how to keep old and new deployment (Kubernetes / Openshift)

如何保持新旧部署 (Kubernetes / Openshift),我没有可分享的脚本,但希望能提供一个示例。


Open Shift POD 的问题。

 1. The current script runs and creates a single POD.
 2. As per requirement every time the script runs it should create 1 POD (which it does)
     Replica set to 1.
 3. When the script is run it creates a POD with the name ABC-1.
 4. When we run the script again it creates another POD with the name ABC-2.
 5. But when we run the script again - it terminates the old POD (ABC-1) and runs the new POD (ABC-2)
 6. what changes should be made so that,
     every time I run the script it creates a new POD but does not terminate the old PODs.
7. If I run the script 5 times - it should have all the PODs as ABC-1, ABC-2, ABC-3, ABC-4, ABC-5.
8. Replica set is 1 every time, but when we run the same script again and again it should keep the old PODs and run the new PODs.

If I run the script 5 times - it should have all the PODs as ABC-1, ABC-2, ABC-3, ABC-4, ABC-5.

如果你想添加(而不是替换)新版本,使用不同的容器镜像(并保留旧的),那么你每次都必须创建一个新的部署资源.

如果您只想要同一个 pod 的更多副本,您可以通过增加副本计数字段来扩展您拥有的 Deployment - 但是所有 Pods 将是相同的。

动态更改部署的作业名称。

最好的方法是动态更改部署名称。在那种情况下,它会保留所有部署,我们不需要将种类定义为 Job 或 Pod。