0

We have a pretty simple setup for the VM on GCP w/o public IP address. To reach the internet, we use cloud NAT (w/ the basic configuration, see attached image):

enter image description here

The problem we have is that the VM loses the internet connection:

  1. we can not access it using SSH
  2. based on the syslog VM can not access GCE metadata server (OSConfigAgent[514]: 2023-03-10T15:49:41.8034Z OSConfigAgent Error main.go:231: network error when requesting metadata, make sure your instance has an active network and can reach the metadata server: Get http://169.254.169.254/computeMetadata/v1/?recursive=true&alt=json&wait_for_change=true&last_etag=2a783d496d54f634&timeout_sec=60: dial tcp 169.254.169.254:80: connect: network is unreachable)

The only solution to this case is to restart the VM & network starts to work. The 2nd log is continuously repeated after something happens. On the other hand we have preceding logs:

  1. systemd-networkd[501671]: ens4: Could not set DHCPv4 address: Connection timed out
  2. systemd-networkd[501671]: ens4: Failed
  3. kernel: [1118386.615077] systemd invoked oom-killer: gfp_mask=0x1100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0

Initially we suspected that the problem may be related to the Cloud NAT, but we do not have any evidence to prove and handle that, because in the NAT logs (errors & transactions) there are no significant errors.

The main idea of this question would be to avoid or handle the such situation automatically, w/o manual intervention. Please let me know if additional information is required.

1
  • Is VM running out of memory ? Please check whether it is showing any OOM-Killer message? Mar 15, 2023 at 13:30

1 Answer 1

2

Your system is sized to small. Notice the message systemd invoked oom-killer.

That is causing the network to fail Could not set DHCPv4 address.

Solution: either improve the applications running on the instance to use less memory or select an instance size that can handle the workload.

2
  • Thanks, just one thing, once we've upgraded the system, it seems that the application uses these free resources (mainly the chromium instances). I wonder, if there is some way of automatically know those instances (or possibly any other application) that there is not enough resources for them. Or even, how to instruct oom-killer that the important services should not be killed? Mar 29, 2023 at 2:33
  • @GiorgiJambazishvili - Recommend creating a new question. Remember, one question per post. Mar 29, 2023 at 4:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .