after long struggle.
So, here is the problem:
After running update-deployment-image command:
kubectl set image deployment/my-app my-app=gcr.io/my-cloud/my-app:new-image-tag
The kubernetes showed that although the new image successfully updated, the old replicaset still remains:
Old replicates are all with 0 pods, but not removed.
Solution
The solution I found is to change the "selector" node in deployment configuration -From:
selector:
matchLabels:
app: my-app
version: $SHORT_SHA
To
selector:
matchLabels:
app: my-app
(Remove the "version" label)
And to add revisionHistoryLimit entry
spec:
replicas: 2
revisionHistoryLimit: 0
selector:
matchLabels:
app: my-app