In the last video I showed you method number one for making changes to a deployment at the very end
of the video.
I told you that we would really be well served to not have to specify the version of an image inside
of our deployment config file.
The reason for that is that if we have to ever open up this file just to change the version of some
image that's always a possibility of introducing some kind of error.
We could very easily accidently make a type of somewhere or we could actually type in the incorrect
version number and so it would be really great if we could figure out some way to not have to specify
the version whatsoever.
And that's what we're going to do inside this video.
Let's take a look at a series of steps that are going to outline exactly how this is going to work.
But this is method number two.
The first you're going to do is to make sure that our deployment is using the latest tag in the pod
spec section.
So back inside of that config file we'll find that image version right there and we can change it to
either latest like so or remember if we just leave off that designation entirely then Docker assumes
that we want to use latest so we can either put on latest or just leave it off entirely.
It is up to you will then save this file.
Now remember just saving this can pick file does nothing whatsoever.
We have to actually take this config file and apply it to our cluster.
So let's do that right now so that the deployment inside of our cluster understands that it should tried
to use the latest version.
Image so back at my terminal I'm going to make sure that I'm inside that infra K AIDS directory and
there's the deployment file right there.
So do a cube CTO apply dash f O's dash double dot demo OK.
So we've now updated our deployment and we told it to try to use the latest version.
Now at this point time if you do a cube Seitel get deployments and you see that we are not running one
pod that is told OK so if you see an error or anything like that right now don't sweat it let's now
go through the series of steps we have back here.
So our deployment is now using the latest tag in the pod spec section.
Now step number two we are going to go ahead and make an update to our code.
So let's make an update to our post code base.
We'll then rebuild the image and then we're going to take that image and push it off to up to Docker
Hub so I'm going to go backwards.
My editor will find a post project directory and the index not just file inside their here's the change
that we made just a moment ago.
Let's make another change right now.
I'm going to change the VA twenty to maybe version fifty five.
Maybe we're just doing huge updates here.
Who knows what.
Whatever we've got some change I'll save that file and then we are going to once again rebuild this
image back at my terminal.
I'll go back into our post directory and inside there we'll rebuild the image with Docker build dash
t your Docker I.D. slash posts and then a dot at the very end again to designate that we want to use
all the code inside of posts OK.
So we've now rebuilt this image.
You'll notice that we have this implicit version added on of latest.
So we're not going to take that image and push it up to Docker Hub so back at my terminal I'll do a
docker push my Docker I.D. slash those
that's going to take the image that we just built and attempt to push it up to Docker Hub.
Now just to save a little bit of time I already built this thing and pushed it up a moment ago just
to save time in this video but for you it's probably and take a minute or two to actually take all the
image data and throw it up to Docker Hub which is totally fine.
OK.
So we've now pushed all these versions or this latest version up to Docker Hub.
So now we want to somehow tell our deployment to use that latest version to do so all we can do is run
QC tell rollout restart deployment and then the name of the deployment itself let's try that out right
now going to first get all my deployments just to make sure I recall the name of the deployment.
There it is right there and they'll do a UCL rollout restart deployment
and then the name of our deployment is post dash devil OK.
So it looks like the deployment has now been restarted.
So let's now do a get deployments again.
It looks like we do have one pod running.
Let's get a list of all of our pods and just make sure that's using the latest version of our code.
Now we'll do a keeps EDL get pods there is our pod.
It looks like it was created just 18 seconds ago.
That's definitely a good sign.
Let's now try to get logs out of this pod and just make sure that we see that V fifty five in there
just to make sure that we are using the latest version of our code.
So I'll do a QVC DL logs and then the name of the pod and there we go there's our 55 awesome OK.
So again two versions or two methods to update the image used by a deployment.
We've got method number one which is going to require us to specify a version number inside of our config
file which is something that we don't really like to do.
So instead I recommend going with this solution right here.
We're going to just always use the latest tag.
Make an update to our code push the image to Docker Hub and then run that command and we're good to
go.
Our cluster is now run the latest version of all of our code.
All right.
Now we've got this all put together one last thing around the world of Cuban eddies in just a moment.
So I'll see you in just a minute.