Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Option to update just the image tag in a deployment #29097

Closed
ApsOps opened this issue Jul 18, 2016 · 10 comments
Closed

Feature request: Option to update just the image tag in a deployment #29097

ApsOps opened this issue Jul 18, 2016 · 10 comments
Labels
area/kubectl priority/backlog Higher priority than priority/awaiting-more-evidence. sig/apps Categorizes an issue or PR as relevant to SIG Apps.

Comments

@ApsOps
Copy link
Contributor

ApsOps commented Jul 18, 2016

Currently, to update the container image running in a deployment, we do something like this:

kubectl set image deployment/nginx-deployment nginx=nginx:1.91

or perhaps using patch to update the image field.

While this works fine, I think container image names are rarely changed, and we just update the image tag. So it might be a good idea to keep tag as a separate field. Then we can do, "set image-tag for this deployment name" without fetching and using the image name again.

Thoughts?

@pwittrock
Copy link
Member

Are you suggesting something like:

kubectl set imagetag deployment/nginx-deployment nginx=1.91

@pwittrock pwittrock added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Jul 18, 2016
@ApsOps
Copy link
Contributor Author

ApsOps commented Jul 18, 2016

Not necessarily the subcommand, but yeah something like that. I currently
send a PATCH request with the full image name and tag to the api. It would
be nice if I can send just the tag. So I guess it would need to add another
field in the PodSpec?

On Tue, 19 Jul 2016 at 1:53 AM, Phillip Wittrock notifications@github.com
wrote:

Are you suggesting something like:

kubectl set imagetag deployment/nginx-deployment nginx=1.91


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#29097 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACQOwoBX0rb28zitK3jagNglk5HczR-qks5qW-DcgaJpZM4JOiE-
.

@morissette
Copy link

Handle in ci/cd pipeline? Heres how I do it:
https://www.dropbox.com/s/838u8dfa1nncml0/ci_cd.png?dl=0

@bgrant0607 bgrant0607 added sig/apps Categorizes an issue or PR as relevant to SIG Apps. and removed team/ux (deprecated - do not use) labels Mar 21, 2017
@0xmichalis
Copy link
Contributor

I am against doing this because tag is not unique in an image spec, eg. I can use the sha hash of the image instead - moreover I think it's more sane to use hashes vs tags but that's another discussion.

@0xmichalis
Copy link
Contributor

set image works fine too

@FingerLiu
Copy link

is this command usable with python client?? https://github.com/kubernetes-incubator/client-python

@joan38
Copy link

joan38 commented Oct 30, 2017

Can anyone point this kubectl set image feature in the API please?
https://kubernetes.io/docs/api-reference/v1.8/

@ApsOps
Copy link
Contributor Author

ApsOps commented Oct 31, 2017

@joan38 I do this, but docs UI seems to have gone downhill. So can't find anything now 🤷‍♂️

url = ("http://{kube_master}/apis/extensions/v1beta1/namespaces/{ns}/"
       "deployments/{d}".format(kube_master=args.kube_master,
                                ns=args.namespace,
                                d=args.deployment))

headers = {'Content-Type': 'application/strategic-merge-patch+json'}

payload = '{"spec":{"template":{"spec":{"containers":[{"name": "%s", "image":"%s"}]}}}}' % (args.deployment, image_name)

 r = requests.patch(url, headers=headers, data=payload)

@pezzati
Copy link

pezzati commented Aug 8, 2018

Sorry to comment on this old issue. I want to update my image after some search i have found below straight command.
kubectl set image deployment/application app-container=$IMAGE
Is this alright to use in productions env?

@oesukam
Copy link

oesukam commented Nov 15, 2022

https://kubernetes.io/docs/api-reference/v1.8/

There is no issue with using it on production depending on your deployment workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl priority/backlog Higher priority than priority/awaiting-more-evidence. sig/apps Categorizes an issue or PR as relevant to SIG Apps.
Projects
None yet
Development

No branches or pull requests

10 participants