And now let's try following.
Let's try to update version of the image in our deployment notice here.
That strategy type is a rolling update.
What does it mean when you release new version of your application?
Of course you want to roll out this new version in production smoothly without any interruption of service.
And Kubernetes allows that out of the box.
And this is very easy.
And this strategy type rolling update means that new ports will be created with new image while previous
ports will be still running.
So both will be replaced one by one.
And finally, in some time, all both will be running in your updated image.
And now let's try that in action.
We will update a bit our application and the build to new image with another tag.
For instance, version 2.0.0.
And afterwards we will modify image in our deployment and see what will happen, how Kubernetes will
roll out this update.
So let's go ahead and do that.
By the way, I don't need this step anymore where I created a SSH connection to Node.
Therefore, let me exit from this connection and close this step actually, and I'll keep only one tap
open.
So let's go back to Visual Studio code and here are contents of the index dot mj's file and we already
have image available for this version of the application where server answers us with such string.
Now let's modify this string.
For instance, let's add here prefix version two like that.
And let's now build new image with a new tag, push it to Docker Hub and afterwards modify image in
our deployment.
Let's save changes in this file, open up a better terminal and let's build image and assign a novel
tech to it.
Now Image has only a single tag.
It is latest.
So let's build new image docker build dot DST tag.
This should prevent your name if you want to push this version of the image to your Docker hub account.
So this task and here will be name of the image gate as web.
Hello.
And after column I'll add the tag for instance 2.0.0.
Like that.
Let's build the such image that I modify it.
Index dot mdgs file and I updated this string so it should build new image.
Let's go ahead and build it.
Building exporting layers.
Image was built and now let's push it to Docker Hub.
I'll copy this name, including Tag.
And now here I enter Docker Push and new version of my application will be pushed using separate tech
for the same gate as web.
Hello image.
So let's go ahead and push.
Pushing.
I see that some layers already exist and only one layer was pushed.
So image was pushed successfully.
Let me verify that.
Go to my Docker hub account.
Refresh.
I still see just a single image.
Here it is.
Let me click on it.
And here I should find to text latest and 2.0.0.
Now let's deploy this new version of this image.
And for that, we will utilize following command.
Let's go to the terminal here and let's set new image for the deployment.
Set image.
We are setting new image for particular deployment.
Next will be deployment.
Name of the deployment.
Kay, it's web.
Hello.
And afterwards, we need to select ports where we would like to set new image.
Here we will write k eight as web.
Hello.
And after equal sign, we will specify new image.
In my case it is business slash k eight as web.
Hello.
Column 2.0.0.
That's a new tech which was assigned by us before we pushed the new version of the image to Docker Hub.
After entering this command image will be changed and rollout update will be started.
Be ready to enter following command after this one.
K Rollout Status Deployment k eight as web.
Hello.
You could prepare this command somewhere in the text editor and afterwards quickly paste it after this
command.
I'll try to enter it manually.
Let's go ahead and change image.
Image.
Updated K Rollout Status Deployment.
Gates.
Webb.
Hello.
Waiting for deployment or allowed to finish.
And now I see the deployment successfully rolled out.
And before I saw such messages as three out of four new replicas have been updated.
One old replicas are pending termination and so on.
Finally, all previous replicas were terminated and new replicas were rolled out.
Lets now list bots get bots and now I see that there are four bots and notice age of those spots.
From 30 to 40 seconds.
It means that previous sports were fully terminated and new boats were created.
And now in all those four boats, we are running a new version of our application and we could verify
that very easily by accessing our deployment.
Using service, there was still service.
Get get SVC.
Type of it is a load balancer and here is cluster IP, here is port and by entering command mini cube
service k8s web.
Hello.
I could open a connection to one of the running ports, so let's go ahead.
Connection was opened and now I see response, which includes version two.
That's how rolling updates work.
You could refresh page here and you should see a response from other server, for instance, this one.
And again here I see version two.
It means that our new application version was successfully deployed to all ports in the deployment.
Wonderful.
That's where I rolling updates.
And that's how you could check status of the rolling update by entering command k rollout status.
This one.
If you would like, you could create one more tag for your image, push it to Docker Hub and verify
how rollout works again.
Or if you want, you could roll back to previous versions.
By the way, we could quickly try that together.
Let's go to this command and here I will remove tech and it will mean that I would like to utilize all
latest tech.
And let's check how image will be modified again.
And we are actually going back to previous version of our application.
Let's modify image.
Let's check.
You're allowed status.
Two out of four new replicas have been updated, waiting for deployment rollout to finish and finally
deployment successfully rolled out.
And again, I will see four completely new ports get ports.
Here was age of those four.
Let's connect to our deployment again, meaning service k eight as well.
Hello.
And I again say hello from the server without version two.
That's where rolling updates.