I know this question has been asked already but I can not find a solution that actually works! The main solution that I have found everywhere and tried is by setting a cron job for when the system reboots with :
@reboot hostname $(curl --silent "http://metadata.google.internal/computeMetadata/v1/instance/attributes/hostname" -H "Metadata-Flavor: Google")
This is after adding the metadata hostname key in the instance settings and it just doesn't work and the hostname keeps getting reset to the name of the instance (I need it as a FQD)
Does anyone have a working solution?