kubernetes/kops · error

cluster %q was not found

Error message

cluster %q was not found

What it means

Guard in RunGetInstanceGroups: GetCluster returned success but a nil cluster, meaning no cluster exists under options.ClusterName. It fires when `kops get instancegroups` is run against a cluster name (from --name or the kubecfg context) that has not been created or is not readable from state storage.

Source

Thrown at cmd/kops/get_instancegroups.go:103

		},
	}

	return cmd
}

func RunGetInstanceGroups(ctx context.Context, f commandutils.Factory, out io.Writer, options *GetInstanceGroupsOptions) error {
	clientset, err := f.KopsClient()
	if err != nil {
		return err
	}

	cluster, err := clientset.GetCluster(ctx, options.ClusterName)
	if err != nil {
		return fmt.Errorf("error fetching cluster %q: %v", options.ClusterName, err)
	}

	if cluster == nil {
		return fmt.Errorf("cluster %q was not found", options.ClusterName)
	}

	list, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
	if err != nil {
		return err
	}

	instancegroups, err := filterInstanceGroupsByName(options.InstanceGroupNames, list.Items)
	if err != nil {
		return err
	}

	singleObject := false

	if len(instancegroups) == 0 {
		return fmt.Errorf("no InstanceGroup objects found")
	} else if len(instancegroups) == 1 {
		singleObject = true

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the cluster name spelling and the --name flag
  2. List clusters with kops get clusters to see what exists
  3. Verify the configured state store is the right one
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/get_instancegroups.go:103 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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