How to Use the GCP's VM manager to manage patch

John C TaylorSeptember 10th 2021, 8:54

Just if you host your virtual machine on the Compute Engine and are in need of a method to patch all the operating systems at a go, you might attempt the OS patch management with the VM manager.

This combination helps to create a patch job that patches your fleet of Linux Virtual Machines. The steps below will aid with the attainment of that end:

Step 1 : Acquire a Linux Virtual Machine that runs on the Compute Engine

Step 2 : Sign in to Google Cloud

Step 3 : Launch the Cloud Shell

Step 4 : Install and configure the VM manager and run the commands below:

gcloud compute project-info add-metadata \
    --project devtutorial \
    --metadata=enable-osconfig=TRUE

gcloud compute project-info add-metadata \
    --project devtutorial \
    --metadata=enable-guest-attributes=TRUE,enable-osconfig=TRUE

Place your Google Cloud Project ID in the place of the PROJECT_ID

Step 5 : Connect to one of your instances by the use of the Cloud Shell SSH browser

Step 6 : Validate the installation of the OS Config Agent by running the following commands:

sudo systemctl status google-osconfig-agent

Step 7 : You should note a similar output from the command if the agent is running

Step 8 : Get to the Cloud Console and navigate to Compute Engine then VM Manager and then OS patch management

Step 9 : Click Enable VM Manager

Step 10 : Click New Patch Deployment

Step 11 : Choose the target zones for your virtual machines

Step 12 : Click Next

Step 13 :  Enter Name Prefixes

Step 14 : Click Next

Step 15 : Select the default options for schedules, rollout, and advanced options

Step 16 : Click Deploy

Step 17 : Your patch job should start automatically

Step 18 : As soon as the job is complete you should observe a status window like this one:

It is a lot easier to tackle the patch updates when managing one virtual machine. On the flip side, the task becomes a lot harder when overseeing a fleet of machines. You require some third-party tools or complicated scripting to do the job.

With the mix of OS Patch management and VM manager, Google Cloud confers to you the tools you need to distribute the patch updates along with multiple options like rolling and restricted updates.