Correct Way to Do Deployment Rolling Update

4 views
Skip to first unread message

Zhang Xiangjun

unread,
May 10, 2016, 11:48:51 PM5/10/16
to Containers at Google
When I use rc, I do rolling update with:

kubectl rolling-update rc/example --image=new_image


Now I use deployment, and I do rolling update with:

kubectl get deployment example -o yaml | sed 's/old_image/new_image' | kubectl apply -f -

But I got the error:

yaml: line 59: found unexpected end of stream



what's the correct way to do deployment rolling update non-interactively?

Matthias Rampke

unread,
May 11, 2016, 2:41:25 AM5/11/16
to google-c...@googlegroups.com

Use `kubectl patch` to edit the deployment directly in Kubernetes. This avoids most consistency problems; get|sed|apply is very fragile.

In the long run, it is probably advisable to keep the source definition of the deployment in version control somewhere, change it there and keep applying that.

/MR

--
You received this message because you are subscribed to the Google Groups "Containers at Google" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-contain...@googlegroups.com.
To post to this group, send email to google-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-containers.
For more options, visit https://groups.google.com/d/optout.

Xiangjun Zhang

unread,
May 11, 2016, 10:37:29 PM5/11/16
to google-c...@googlegroups.com
Thanks.

kubectl patch deployment example --type=json -p='[{"op":"replace", "path":"/spec/template/spec/containers/0/image", "value":"new_image"}]' works well.

--
You received this message because you are subscribed to a topic in the Google Groups "Containers at Google" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-containers/5reYpRlCRH8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-contain...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages