Rollout history and replace command

Hi

I was working on an exercise with deployment, and I remarked that when I was using the apply -f command, the rollout history updated ok, but when I was using the replace --force command, the rollout history went back to 1 (I had to do replace --force because it was to change the rolling strategy, apply -f does not work in this case).
I suppose I will have the same problem if I change the maxSurge or maxUnavailable when keeping the same strategy type.

What do I need to do to keep the rolling history ?

Hi @stephane.hordoir

You should be able to change the deployment strategy without replacing the resource. By definition, replace deletes and recreates the resource, so you will lose the history.

If the deployment is running, use kubectl edit to change it in place

Hi @Alistair_KodeKloud

Thanks for your reply
I have used kubectl edit to change the maxSurge or maxUnavailable and it works ok, but it does not trigger a revision, only when I change the image does it trigger a new revision, is it normal ?

Editing the rollout strategy does not trigger a redeployment. All you’ve done is set the parameters that will be used next time a redeployment happens.

1 Like