google_osconfig's CPU usage of VM on Google Cloud Platform increases steadily

google_osconfig It is part of the VM Manager, this definition is in the documentation

VM Manager is a suite of tools that can be used to manage operating systems for large virtual machine (VM) fleets running Windows and Linux on Compute Engine.

The following services are available as part of the VM Manager suite:

  • OS inventory management: osinventory
  • OS patch management: tasks
  • OS configuration management: guestpolicies

The OS Config agent is installed by default on Red Hat Enterprise Linux (RHEL), Debian, CentOS, and Windows images that have a build date of v20200114 or later.

You could check the status of this service with the following command:

sudo systemctl status google-osconfig-agent

If it was a problem with some subprocess that started the CPU consumptions the restart you made will fix it.

But it might a problem with the service, maybe the version you are using has a problem, you could consider updating the OS Config agent.

To update the agent on CentOS and RHEL operating systems, run the following command:

sudo yum update google-osconfig-agent

To update the agent on Debian and Ubuntu operating systems, run the following commands:

sudo apt update
sudo apt install google-osconfig-agent
sudo service google-osconfig-agent restart

This is a known bug in some older versions of osconfig (pre-Dec 2020). To permanently fix, update to a current version:

sudo apt update
sudo apt install google-osconfig-agent
sudo service google-osconfig-agent restart