kubernetes/kops · error

listing InstanceGroups: %v

Error message

listing InstanceGroups: %v

What it means

When deleting a control-plane instance group, the command lists all instance groups of the cluster to check whether others with a control-plane role exist. If that List API call fails, the error is wrapped as "listing InstanceGroups: %v".

Source

Thrown at cmd/kops/delete_instancegroup.go:153

	clientset, err := f.KopsClient()
	if err != nil {
		return err
	}

	group, err := clientset.InstanceGroupsFor(cluster).Get(ctx, groupName, metav1.GetOptions{})
	if err != nil {
		return fmt.Errorf("error reading InstanceGroup %q: %v", groupName, err)
	}
	if group == nil {
		return fmt.Errorf("InstanceGroup %q not found", groupName)
	}

	fmt.Fprintf(out, "InstanceGroup %q found for deletion\n", groupName)

	if group.Spec.Role.HasControlPlane() {
		groups, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
		if err != nil {
			return fmt.Errorf("listing InstanceGroups: %v", err)
		}

		onlyMaster := true
		for _, ig := range groups.Items {
			if ig.Name != groupName && ig.Spec.Role.HasControlPlane() {
				onlyMaster = false
				break
			}
		}

		if onlyMaster {
			return fmt.Errorf("cannot delete the only control plane instance group")
		}
	}

	if !options.Yes {
		fmt.Fprintf(out, "\nMust specify --yes to delete instancegroup\n")
		return nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped %v message for the root cause
  2. Verify state store access: kops get clusters --state <store>
  3. Fix credentials/permissions on the state store bucket, then retry
Defensive patterns

Strategy: retry

Validate before calling

kops get clusters --state $KOPS_STATE_STORE  # verify state store reachability first

Try / catch

err := RunDeleteInstanceGroup(ctx, f, out, opts)
if err != nil && strings.Contains(err.Error(), "listing InstanceGroups") {
    // transient state store failure: back off and retry
    time.Sleep(2 * time.Second)
    err = RunDeleteInstanceGroup(ctx, f, out, opts)
}

Prevention

When it happens

Trigger: group.Spec.Role.HasControlPlane() is true and clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{}) returns a non-nil error (state store unreachable, auth failure).

Common situations: Deleting a control-plane IG while the kOps state store (S3/GCS/etc.) is unreachable or credentials are broken; malformed cluster config.

Related errors


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