kubernetes/kops · error

error getting cluster: %q: %v

Error message

error getting cluster: %q: %v

What it means

RunCreateInstanceGroup loads the target cluster (e.g. via GetCluster) before building the IG spec; this wraps that lookup failing - typically the cluster does not exist, the state store is unreachable, or permissions are lacking.

Source

Thrown at cmd/kops/create_instancegroup.go:172

	cmd.RegisterFlagCompletionFunc("subnet", completeClusterSubnet(f, &options.Subnets))

	cmd.Flags().StringSliceVar(&options.Zones, "zone", options.Zones, "Zones in which to create instance group. One of Availability Zone like eu-west-1a or a comma-separated list of multiple Availability Zones.")

	// DryRun mode that will print YAML or JSON
	cmd.Flags().BoolVar(&options.DryRun, "dry-run", options.DryRun, "Only print the object that would be created, without created it. This flag can be used to create an instance group YAML or JSON manifest.")
	cmd.Flags().StringVarP(&options.Output, "output", "o", options.Output, "Output format. One of json or yaml")
	cmd.RegisterFlagCompletionFunc("output", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
		return []string{"json", "yaml"}, cobra.ShellCompDirectiveNoFileComp
	})
	cmd.Flags().BoolVar(&options.Edit, "edit", options.Edit, "Open an editor to edit default values")

	return cmd
}

func RunCreateInstanceGroup(ctx context.Context, f *util.Factory, out io.Writer, options *CreateInstanceGroupOptions) error {
	cluster, err := GetCluster(ctx, f, options.ClusterName)
	if err != nil {
		return fmt.Errorf("error getting cluster: %q: %v", options.ClusterName, err)
	}

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

	channel, err := cloudup.ChannelForCluster(clientset.VFSContext(), cluster)
	if err != nil {
		klog.Warningf("%v", err)
	}

	existing, err := clientset.InstanceGroupsFor(cluster).Get(ctx, options.InstanceGroupName, metav1.GetOptions{})
	if err != nil {
		// We expect a NotFound error when creating the instance group
		if !errors.IsNotFound(err) {
			return err
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the cluster name and that it exists in the state store
  2. Check state store (S3/GCS) access and credentials
  3. Create the cluster first if it does not yet exist
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/kops/create_instancegroup.go:172 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/7bf15acc68ac6c3a. Report an issue: GitHub.