kubernetes/kops · error

error finding CloudInstanceGroups: %v

Error message

error finding CloudInstanceGroups: %v

What it means

DeleteInstanceGroup first asks the cloud provider to enumerate the cloud groups backing the given InstanceGroup via Cloud.GetCloudGroups. If that cloud API call fails (auth issues, throttling, network, missing group), the error is wrapped and returned, and no deletion proceeds.

Source

Thrown at pkg/instancegroups/delete.go:43

	api "k8s.io/kops/pkg/apis/kops"
	"k8s.io/kops/pkg/client/simple"
	"k8s.io/kops/upup/pkg/fi"
)

// DeleteInstanceGroup removes the cloud resources for an InstanceGroup
type DeleteInstanceGroup struct {
	Cluster   *api.Cluster
	Cloud     fi.Cloud
	Clientset simple.Clientset
}

// DeleteInstanceGroup deletes a cloud instance group
func (d *DeleteInstanceGroup) DeleteInstanceGroup(group *api.InstanceGroup) error {
	ctx := context.TODO()

	groups, err := d.Cloud.GetCloudGroups(d.Cluster, []*api.InstanceGroup{group}, false, nil)
	if err != nil {
		return fmt.Errorf("error finding CloudInstanceGroups: %v", err)
	}

	for _, g := range groups {
		if g.InstanceGroup == nil || g.InstanceGroup.Name != group.Name {
			return fmt.Errorf("found group with unexpected name: %v", g)
		}
	}

	// TODO should we drain nodes and validate the cluster?
	for _, g := range groups {
		klog.Infof("Deleting %q", group.ObjectMeta.Name)

		err = d.Cloud.DeleteGroup(g)
		if err != nil {
			return fmt.Errorf("error deleting cloud resources for InstanceGroup: %v", err)
		}
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped error to identify the cloud API failure and fix credentials/network
  2. Verify the instance group still exists in the cloud console; if already deleted, skip cloud deletion
  3. Retry after transient cloud API errors (throttling/outage) resolve
Defensive patterns

Strategy: retry

Validate before calling

// Pre-check that the cloud credentials and cluster metadata are set before deleting
if d.Cloud == nil || d.Cluster == nil {
	return fmt.Errorf("cloud and cluster must be initialized before DeleteInstanceGroup")
}

Try / catch

err := d.DeleteInstanceGroup(ig)
if err != nil && strings.Contains(err.Error(), "error finding CloudInstanceGroups") {
	// transient cloud API failure; back off and retry
	time.Sleep(10 * time.Second)
	err = d.DeleteInstanceGroup(ig)
}

Prevention

When it happens

Trigger: Calling DeleteInstanceGroup with a Cloud whose GetCloudGroups call errors: invalid credentials, cloud API outage/rate limits, or referencing an instance group whose cloud resources were already removed.

Common situations: Running `kops delete ig` against a cluster whose autoscaling group was deleted out-of-band, expired AWS/GCP credentials, or network partition from the cloud API.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/ad8ff6e41dc79fc2. Report an issue: GitHub.