I have a strange problem whereby instances in an instance-group reboot themselves when I give them a sudo poweroff
command (I'm doing this in a startup-script is that makes any difference...)
I've also tried the more elaborate gcloud compute instances delete -q --zone europe-west1-c $HOSTNAME
to no avail.
What is the correct way to do this?
Instance groups spawn and restart instances on demand as required by its management policy. If necessary, when an instance goes down, the policy will wake it again; when deleted, another one will be created in its place.
Removing an instance from an instance group requires modifying the instance group as described here. Resizing the instance group size depends on the management policy:
Hope this helps.