0

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?

Grzenio
  • 35,875
  • 47
  • 158
  • 240
Theolodus
  • 2,004
  • 1
  • 23
  • 30

1 Answers1

0

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:

  • For replica pool managed instance groups check here
  • For autoscaler managed instances groups check here

Hope this helps.

Antxon
  • 1,855
  • 15
  • 21
  • Thanks, these links led me to the right way to do this. Half my problem was that I'm using the python API library to create the instance-group, and the `gcloud preview instance-groups` / `gcloud preview replica-pools` command doesn't always play well with instances created that way... – Theolodus Feb 12 '15 at 09:43
  • I verified this using the Developers Console to create the resources and got the same behavior. So, I don't think this is related to using the API, but to the way the management policy manages the instances in the group. – Antxon Feb 12 '15 at 16:44
  • You're right, I was just getting lucky. On further investigation, disabling auto-restart in the instance template used by the instance-group seems to have done the trick. Thanks for your help! – Theolodus Feb 13 '15 at 08:51