Issue
I can't ssh into my VM, the firewall is open with port 22, my IP, and IAP IP range, I'm the owner of the project, so I go to the serial port to find out why.
I just found those error logs, but I don't quite understand all of them.
GCEGuestAgent Error non_windows_accounts.go:158: Error updating SSH keys for {USER}: mkdir /home/{USER}/.ssh: no such file or directory.
OSConfigAgent Warning: Error waiting for task (attempt 1 of 10): rpc error: code = Unavailable desc = 502:Bad Gateway
OSConfigAgent Warning: Error waiting for task (attempt 1 of 10): rpc error: code = Unavailable desc = transport is closing
Solution
Since I just did some tests. I found where is the problem which is the VM is missing the directory and the guest agent is not able to make a new directory . Therefore, the approach is to create manually a path with /home/{USER}/.ssh
After that, try to ssh into VM again, you would work well. and you will see the /home/{USER}/.ssh/authorized_keys
this file.
I don't know why the guest agent was not able to mkdir the folder. But this approach works for me.
Answered By - Tim Chiang Answer Checked By - Marie Seifert (WPSolving Admin)