kubernetes/kops · error

no instance groups found

Error message

no instance groups found

What it means

BuildOptions for the kube-apiserver component derives APIServerCount from the cluster's instance groups (essentially the number of control-plane groups). When buildAPIServerCount returns 0 — no instance groups are registered with the cluster — there is no basis to size the API server replication, so the model builder refuses to continue.

Source

Thrown at pkg/model/components/apiserver.go:52

// KubeAPIServerOptionsBuilder adds options for the apiserver to the model
type KubeAPIServerOptionsBuilder struct {
	*OptionsContext
}

var _ loader.ClusterOptionsBuilder = &KubeAPIServerOptionsBuilder{}

// BuildOptions is responsible for filling in the default settings for the kube apiserver
func (b *KubeAPIServerOptionsBuilder) BuildOptions(cluster *kops.Cluster) error {
	clusterSpec := &cluster.Spec
	if clusterSpec.KubeAPIServer == nil {
		clusterSpec.KubeAPIServer = &kops.KubeAPIServerConfig{}
	}
	c := clusterSpec.KubeAPIServer

	if c.APIServerCount == nil {
		count := b.buildAPIServerCount(clusterSpec)
		if count == 0 {
			return fmt.Errorf("no instance groups found")
		}
		c.APIServerCount = new(int32(count))
	}

	// @question: should the question every be able to set this?
	if c.StorageBackend == nil {
		// @note: we can use the first version as we enforce both running the same versions.
		// albeit feels a little weird to do this
		sem, err := semver.Parse(strings.TrimPrefix(clusterSpec.EtcdClusters[0].Version, "v"))
		if err != nil {
			return err
		}
		c.StorageBackend = new(fmt.Sprintf("etcd%d", sem.Major))
	}

	if c.KubeletPreferredAddressTypes == nil {
		// We prioritize the internal IP above the hostname
		c.KubeletPreferredAddressTypes = []string{

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Create at least one instance group with role Master before running update: `kops create instancegroup master-<zone> --role Master`
  2. If using the Go API, attach InstanceGroup objects to the cluster before invoking the apiserver model builder
  3. Explicitly set cluster.spec.kubeAPIServer.count if you must render the model without instance groups

Example fix

// before: updating a cluster with no instance groups
kops update cluster mycluster.example.com
// error: no instance groups found
// after
kops create instancegroup master-us-east-1a --role Master --zones us-east-1a
kops update cluster mycluster.example.com
Defensive patterns

Strategy: validation

Validate before calling

igs, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
if err != nil { return err }
if len(igs.Items) == 0 {
	return fmt.Errorf("create at least one instance group (role Master) before updating cluster %s", cluster.Name)
}

Type guard

func hasInstanceGroups(igs []*kops.InstanceGroup) bool { return len(igs) > 0 }

Try / catch

if err := buildModel(); err != nil {
	if strings.Contains(err.Error(), "no instance groups found") {
		// create master instance group, then retry once
	}
	return err
}

Prevention

When it happens

Trigger: Calling the apiserver component BuildOptions (e.g. during `kops update cluster` model rendering) when the cluster has zero instance groups attached, or when instance groups have not yet been created/applied for a new cluster.

Common situations: Provisioning a cluster programmatically via the API before any InstanceGroup (master) is added; a cluster manifest missing instanceGroups; a tool that edits cluster.spec without ever creating instance groups.

Related errors


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