How to keep old and new deployment (Kubernetes / Openshift), I don't have a script to share but an example would be appreciated.
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.
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.
Change job name for the deployment dynamically.
The best way possible is to change the Deployment name, dynamically. In that case, it keeps all the deployments and we don't need to define kind as Job or Pod.