kubernetes/kops · error

instance group %q not found

Error message

instance group %q not found

What it means

After listing the cluster's instance groups, GetInstanceGroup finds none matching b.InstanceGroupName and returns this error naming the requested group. The name was provided but does not exist in the cluster's state store.

Source

Thrown at pkg/commands/toolbox_enroll.go:563

	instanceGroups, err := b.GetInstanceGroups(ctx)
	if err != nil {
		return nil, err
	}

	if b.InstanceGroupName == "" {
		return nil, fmt.Errorf("InstanceGroup name is missing")
	}

	// Build full IG spec to ensure we end up with a valid IG
	for i := range instanceGroups.Items {
		ig := &instanceGroups.Items[i]
		if ig.Name == b.InstanceGroupName {
			b.InstanceGroup = ig
			return ig, nil
		}
	}
	return nil, fmt.Errorf("instance group %q not found", b.InstanceGroupName)
}

func (b *ConfigBuilder) GetFullInstanceGroup(ctx context.Context) (*kops.InstanceGroup, error) {
	if b.fullInstanceGroup != nil {
		return b.fullInstanceGroup, nil
	}

	clientset, err := b.GetClientset(ctx)
	if err != nil {
		return nil, err
	}

	fullCluster, err := b.GetFullCluster(ctx)
	if err != nil {
		return nil, err
	}

	cloud, err := b.GetCloud(ctx)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run `kops get instancegroups <cluster>` (or kubectl get ig) and copy the exact group name
  2. Confirm the ClusterName on the builder matches the intended cluster
  3. Recreate the missing instance group with `kops create ig` if it was deleted
  4. Check for case/whitespace differences in the name

Example fix

// before
b.InstanceGroupName = "Nodes"   // actual group is "nodes"
// after
$ kops get ig --name c1.example.com
b.InstanceGroupName = "nodes"
Defensive patterns

Strategy: validation

Validate before calling

igs, err := b.GetInstanceGroups(ctx)
if err != nil { return err }
names := map[string]bool{}
for _, ig := range igs.Items { names[ig.Name] = true }
if !names[b.InstanceGroupName] {
    return fmt.Errorf("%q not in %v", b.InstanceGroupName, names)
}

Type guard

func instanceGroupExists(igs *kops.InstanceGroupList, name string) bool {
    for _, ig := range igs.Items { if ig.Name == name { return true } }
    return false
}

Try / catch

ig, err := b.GetInstanceGroup(ctx)
if err != nil && strings.Contains(err.Error(), "not found") {
    return fmt.Errorf("run `kops get ig` and use an exact group name")
}

Prevention

When it happens

Trigger: GetInstanceGroup called with an InstanceGroupName that doesn't match any group returned by clientset.InstanceGroupsFor(cluster).List — typo, group deleted, or wrong cluster.

Common situations: Typo in `kops toolbox enroll --name <ig>`; instance group was deleted or renamed; pointing at the wrong cluster name so the group list is a different cluster's; case mismatch.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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