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

Time:10-06

How to keep old and new deployment (Kubernetes / Openshift), I don't have a script to share but an example would be appreciated.

  • Deployment terminates the old deployment, but in this case, I need the old and new deployments working.
  • Run a job inside a POD.
  • And when the job completes kill the created POD.

The issue with 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.

CodePudding user response:

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

If you want to add (not replace) new versions, with a different container image (and keep the old), then you have to create a new Deployment resource each time.

If you just want more replicas of the same pod, you can scale up the Deployment that you have by increasing the replica count field - but then all Pods will be identical.

CodePudding user response:

It runs as Kind: Job, changed it from Kind: Deploymentconfig, also had to make minor changes to the template. Thanks

  • Related