skip to Main Content

I have a pipeline which creates an image and pushes to Quay repository and then deploys to Openshift cluster. In my deployment-config file I have mentioned the image name as quay.:dev. So whenever a new image is created, it is created with same name and tag.
My question is will this pipeline and deployment make any changes to the pod running in the namespace or it will not identify any change and old pod will keep on running ?
Do I need to change tag on every run ?

3

Answers


  1. You need to change the image tag on every run. As a general rule, in Kubernetes you want to avoid fixed image tags like ...:dev or ...:latest.

    With the workflow you suggest, two things will happen.

    First, updating the Kubernetes Deployment will have no effect. The new Deployment object will be byte-for-byte identical to the old one. The cluster will see you want to have 3 Pods running the quay...:dev image, and those exist, so there’s nothing to change.

    Second, the images in the cluster can get out of sync. Kubernetes (and plain Docker) will normally only pull an image if it doesn’t exist on the node. So if you do start a new Pod and some quay...:dev image already exists on the node, it will just get used as-is. But say a node fails and is replaced, and it was running a replica of your application; the new node won’t have a copy of your image, and if the replacement Pod is scheduled there then it will pull the then-current copy of the image, even though it’s not the same actual build as in the rest of the cluster.

    I’d recommend using a unique tag for every build of your application. The source control commit ID or the current date/time are two things that are easy to use. You then need to update the Deployment’s image: on every build, but since this changes it will cause every existing Pod to be replaced with the newer image.

    Login or Signup to reply.
  2. My question is will this pipeline and deployment make any changes to the pod running in the namespace or it will not identify any change and old pod will keep on running ?

    If the field imagePullPolicy: Always is set, new image will be pulled despite they have same name/tag. This is because the image digest has changed.

    Do I need to change tag on every run ?

    Highly recommended. Tag is a great help to identify which built is causing issue.

    Login or Signup to reply.
  3. Hello when you say If the field imagePullPolicy: Always is set, new image will be pulled despite they have same name/tag. This is because the image digest has changed., I think, this doesn’t work. I have it and my pod doesn’t update with kubectl set image with the same image name tag 🙁

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search