kubernetes/kops · error

InstanceGroups::Watch not supported for server-side client

Error message

InstanceGroups::Watch not supported for server-side client

What it means

Watch is not implemented on the server-side instanceGroups wrapper in kops-controller's clientset. The controller does not stream watch events for InstanceGroups through this client, so Watch unconditionally returns this sentinel error and a nil watch.Interface. It is a deliberate design limitation, not a transient failure.

Source

Thrown at cmd/kops-controller/pkg/controllerclientset/instancegroups.go:116

func (c *instanceGroups) Create(ctx context.Context, g *kopsapi.InstanceGroup, opts metav1.CreateOptions) (*kopsapi.InstanceGroup, error) {
	return nil, fmt.Errorf("InstanceGroups::Create not supported for server-side client")
}

func (c *instanceGroups) Update(ctx context.Context, g *kopsapi.InstanceGroup, opts metav1.UpdateOptions) (*kopsapi.InstanceGroup, error) {
	return nil, fmt.Errorf("InstanceGroups::Update not supported for server-side client")
}

func (c *instanceGroups) Delete(ctx context.Context, name string, options metav1.DeleteOptions) error {
	return fmt.Errorf("InstanceGroups::Delete not supported for server-side client")
}

func (r *instanceGroups) DeleteCollection(ctx context.Context, options metav1.DeleteOptions, listOptions metav1.ListOptions) error {
	return fmt.Errorf("InstanceGroups::DeleteCollection not supported for server-side client")
}

func (r *instanceGroups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
	return nil, fmt.Errorf("InstanceGroups::Watch not supported for server-side client")
}

func (r *instanceGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *kopsapi.InstanceGroup, err error) {
	return nil, fmt.Errorf("InstanceGroups::Patch not supported for server-side client")
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Poll with List(ctx, metav1.ListOptions{}) on a ticker instead of using Watch
  2. Use a separate informer/watch built on the standard Kubernetes clientset for InstanceGroups
  3. Only call Watch behind a capability check that verifies the clientset supports it
  4. Implement Watch in cmd/kops-controller/pkg/controllerclientset/instancegroups.go if streaming is truly required

Example fix

// before
watcher, err := client.InstanceGroups().Watch(ctx, metav1.ListOptions{})
if err != nil { return err }
for ev := range watcher.ResultChan() { ... }
// after
ticker := time.NewTicker(30 * time.Second)
for {
	select {
	case <-ctx.Done():
		return ctx.Err()
	case <-ticker.C:
		groups, err := client.InstanceGroups().List(ctx, metav1.ListOptions{})
		if err != nil { return err }
		// process groups
	}
}
Defensive patterns

Strategy: fallback

Validate before calling

if _, ok := igClient.(interface{ Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) }); !ok {
	usePollingFallback = true
}

Type guard

func supportsWatch(v interface{}) bool {
	w, ok := v.(interface {
		Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
	})
	_ = w
	return ok
}

Try / catch

watcher, err := igClient.Watch(ctx, metav1.ListOptions{})
if err != nil {
	if strings.Contains(err.Error(), "not supported for server-side client") {
		return pollInstanceGroups(ctx, 30*time.Second) // fallback: periodic List
	}
	return err
}

Prevention

When it happens

Trigger: Calling ctxClient.InstanceGroups().Watch(ctx, metav1.ListOptions{}), or wiring this resource into a watch/informer loop (e.g. informers, watch.Until, cache.ListWatch) that expects a functioning Watch endpoint.

Common situations: Building a custom controller loop over InstanceGroups with informers; switching from the standard kops clientset to the controller server-side clientset and inheriting watch-based code; polling tools that fall back to watch for change detection.

Related errors


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