kubernetes/kops · error

InstanceGroup %q not found

Error message

InstanceGroup %q not found

What it means

When --instance-group (or options.InstanceGroups) is supplied, RunRollingUpdateCluster filters the cluster's instance groups to the named ones. If a requested name does not match any InstanceGroup in the cluster, it returns "InstanceGroup %q not found". This is a user-input validation error against the cluster's actual IG list.

Source

Thrown at cmd/kops/rolling-update_cluster.go:313

	if countByRole[kopsapi.InstanceGroupRoleAPIServer]+countByRole[kopsapi.InstanceGroupRoleControlPlane] <= 1 {
		options.DeregisterControlPlaneNodes = false
	}

	warnUnmatched := true

	if len(options.InstanceGroups) != 0 {
		var filtered []*kopsapi.InstanceGroup

		for _, instanceGroupName := range options.InstanceGroups {
			var found *kopsapi.InstanceGroup
			for _, ig := range instanceGroups {
				if ig.ObjectMeta.Name == instanceGroupName {
					found = ig
					break
				}
			}
			if found == nil {
				return fmt.Errorf("InstanceGroup %q not found", instanceGroupName)
			}

			filtered = append(filtered, found)
		}

		instanceGroups = filtered

		// Don't warn if we find more ASGs than IGs
		warnUnmatched = false
	}

	if len(options.InstanceGroupRoles) != 0 {
		var filtered []*kopsapi.InstanceGroup

		for _, role := range options.InstanceGroupRoles {
			s, f := kopsapi.ParseInstanceGroupRole(role, true)
			if !f {
				return fmt.Errorf("invalid instance group role %q", role)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. List actual instance groups: kops get instancegroups <cluster> (or kops get ig <cluster>) and correct the --instance-group value
  2. Check you are targeting the right cluster name/state store (KOPS_STATE_STORE)
  3. Recreate the missing IG with kops create ig if it was deleted intentionally
  4. Remove the --instance-group flag to roll all groups

Example fix

// before
kops rolling-update cluster mycluster.k8s.local --instance-group nodez
// error: InstanceGroup "nodez" not found
// after (name corrected per `kops get ig`)
kops rolling-update cluster mycluster.k8s.local --instance-group nodes
Defensive patterns

Strategy: validation

Validate before calling

// list instance groups and check membership before invoking
igs, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
if err != nil { return err }
wanted := "nodes"
found := false
for _, ig := range igs.Items {
    if ig.ObjectMeta.Name == wanted { found = true; break }
}
if !found { return fmt.Errorf("instance group %q does not exist; run `kops get ig`", wanted) }

Prevention

When it happens

Trigger: options.InstanceGroupName (e.g. from --instance-group) contains a name for which no kopsapi.InstanceGroup with matching ObjectMeta.Name exists in the instance groups fetched from the cluster state store.

Common situations: Typo in the IG name (e.g. nodes-eu-west vs nodes); IG was renamed or deleted; running against the wrong cluster that lacks that IG; referencing a master IG by an old name.

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/071c53f38fd98f7d. Report an issue: GitHub.