Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes kubectl set image deployment not able to --record history?

According to the user guide it should be possible to update a deployment's image with kubectl set/edit and still get a meaningful history.

However i'm getting some errors instead, and no meaningful history, could this be a bug?

$ kubectl create -f kubernetes/deployment.yml --record
deployment "nginx" created

$ kubectl set image deployment/nginx nginx=nginx:0.2.0
deployment "nginx" image updated
changes to deployments/nginx can't be recorded: Operation cannot be fulfilled on deployments.extensions "nginx": the object has been modified; please apply your changes to the latest version and try againc

$ kubectl set image deployment/nginx nginx=nginx:0.2.1
deployment "nginx" image updated
changes to deployments/nginx can't be recorded: Operation cannot be fulfilled on deployments.extensions "nginx": the object has been modified; please apply your changes to the latest version and try again

$ kb rollout history deployment/nginx
deployments "nginx":
REVISION  CHANGE-CAUSE
1   kubectl create -f kubernetes/deployment.yml --record
2   kubectl create -f kubernetes/deployment.yml --record
3   kubectl create -f kubernetes/deployment.yml --record

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.0+2831379", GitCommit:"283137936a498aed572ee22af6774b6fb6e9fd94", GitTreeState:"not a git tree", BuildDate:"2016-07-05T15:40:13Z", GoVersion:"go1.6.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.0", GitCommit:"283137936a498aed572ee22af6774b6fb6e9fd94", GitTreeState:"clean", BuildDate:"2016-07-01T19:19:19Z", GoVersion:"go1.6.2", Compiler:"gc", Platform:"linux/amd64"}

Thanks!

like image 275
aristidesfl Avatar asked Nov 08 '22 12:11

aristidesfl


1 Answers

This is due to update conflict when we update the deployment's annotation (for recording its change history). This means that the deployment object is modified (most likely by server) when kubectl updates the deployment change history. kubectl set image currently won't retry change history update on conflict for you.

I've filed a fix to mitigate this.

like image 181
janetkuo Avatar answered Nov 15 '22 08:11

janetkuo