[MUSIC PLAYING]
SPEAKER: Google Compute Engine enables you to deploy updates
to virtual machine instances in managed instance groups using
two different methods.
One, rolling update incrementally
deploys updates in all the VMs of the image.
Two, canary deployment deploys updates
to a subset of VMs in the image.
This enables you to test the update on some VMs
before the update is deployed on all the VMs.
In this video, we will focus on how to perform
rolling update to MIGs.
MIGs support two types of update modes.
First, automatic or proactive.
In this mode, you can roll out new configurations
to all or to a subset of the instances automatically in MIG.
Here are some advantages of proactive mode.
No manual intervention is required.
You can automate rollouts partially
with reactive mode, which allows you to perform testing
similar to canary update.
Here is a quick tip.
Choose automatic mode when you want
to deploy a critical update across instances immediately.
Second, selective or opportunistic.
You can manually start the update on selected instances
or when a new instance are created.
Now, some advantages of selective mode.
You will have a better control on the timing
and the sequence of the update.
And here's some tip for you.
Choose selective mode when you want
to perform a pre-planned update during a maintenance period,
so that the impacts, such as performance degradation
or downtime, can be avoided for you.
Now, let's look at how to perform a rolling
update in proactive mode.
In your Google Cloud console, go to Compute Engine and Instance
Groups.
In our project, there are two instance groups, rolling update
proactive mode, rolling update opportunistic mode.
Each of these MIGs have three instances.
Other than that, we also have two templates
which we use to create and update the MIGs.
Application version V1, this is the current version deployed.
Application version V2, this is the new version
we want to upgrade the VMs in our MIG.
Select the MIG that you want to update.
In this example, we will update rolling update proactive mode
MIG.
Click Update VMs.
Under New template, click the dropdown list
to select the new template to update to.
We will select application version V2.
Under Update Configuration, expand the selection menu.
Select automatic as the update type to trigger proactive mode.
With proactive mode, you can control the disruption level
during rolling update by selecting the appropriate value
from the dropdown list in action allowed to update VMs.
With each option, there are different instance properties
which will be updated.
Select the option that works for your requirement.
We will select Replace, which replaces the current instances
with new instance.
Next one is maximum surge.
It indicates the number of VMs that you
want to create above the target size
before deleting the old instances.
Note, the additional instances will temporarily
run at the same time as the instances it replaces.
Setting up a higher value for maximum surge
can improve the speed of the update.
However, it will incur cost for the additional instances
created.
Max unavailable.
It indicates the number of instances
taken offline or unavailable during the update time.
Note, max unavailable value can cause downtime on our MIG
if the value is close or equal to the number of instances
in the MIG.
The default value for max surge and max unavailable
is 1 for zonal MIG and 3 for regional MIG.
Let's proceed with the default value of 1 for max surge
and max unavailable.
Next, in advanced configuration, we have minimum wait time.
This value sets the length of time
to wait between two successive instance updates.
All right.
We are all set.
Now click on Update VMs.
We can open the instance group in another window
to view the instances being stopped and getting
replaced by the new instances with the updated application
version.
All right.
Let's now look at how to apply a selective update.
In our project, select the MIG, rolling
update opportunistic mode.
Select Update VMs.
Under New Template, select Application version V2.
Select the option of selective mode
under update configuration.
Select Done.
Click Update VMs.
Now, click on the Instance Group.
Select one of the instance, and proceed for deletion.
There you go.
We can see that a new VM has spawned up as a part of the MIG
with the new version of the application.
Note that, because we have chosen selective mode,
the other two VMs will not be updated automatically.
Check out the documentation to learn more
about the proactive and selective modes
in rolling update.
[MUSIC PLAYING]