kubernetes/kops · error

method UpdateCluster not supported in server-side client

Error message

method UpdateCluster not supported in server-side client

What it means

Like CreateCluster, UpdateCluster is intentionally unimplemented in the server-side clientset: mutating cluster spec/status through the controller client is not supported. The method exists only to satisfy the interface and always returns this error.

Source

Thrown at cmd/kops-controller/pkg/controllerclientset/clientset.go:92

	if !ok {
		return nil, fmt.Errorf("unexpected kind for cluster, got %T, want kops.Cluster", object)
	}
	return cluster, nil
}

// VFSContext returns a VFSContext.
func (c *client) VFSContext() *vfs.VFSContext {
	return c.vfsContext
}

// CreateCluster creates a cluster
func (c *client) CreateCluster(ctx context.Context, cluster *kops.Cluster) (*kops.Cluster, error) {
	return nil, fmt.Errorf("method CreateCluster not supported in server-side client")
}

// UpdateCluster updates a cluster
func (c *client) UpdateCluster(ctx context.Context, cluster *kops.Cluster, status *kops.ClusterStatus) (*kops.Cluster, error) {
	return nil, fmt.Errorf("method UpdateCluster not supported in server-side client")
}

// ListClusters returns all clusters
func (c *client) ListClusters(ctx context.Context, options metav1.ListOptions) (*kops.ClusterList, error) {
	return nil, fmt.Errorf("method ListClusters not supported in server-side client")
}

// ConfigBaseFor returns the vfs path where we will read configuration information from
func (c *client) ConfigBaseFor(cluster *kops.Cluster) (vfs.Path, error) {
	return nil, fmt.Errorf("method ConfigBaseFor not supported in server-side client")
}

// InstanceGroupsFor returns the InstanceGroupInterface bound to the namespace for a particular Cluster
func (c *client) InstanceGroupsFor(cluster *kops.Cluster) kopsinternalversion.InstanceGroupInterface {
	clusterName := cluster.Name
	if clusterName != c.clusterName {
		klog.Fatalf("clientset bound to cluster %q, got cluster %q", c.clusterName, clusterName)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Avoid mutating cluster objects from kops-controller; apply changes via the `kops` CLI (kops update cluster / kops replace -f)
  2. Use a VFS-backed clientset if programmatic writes are required in a tool you control
  3. Store controller-local state in a separate object/ConfigMap rather than the kops Cluster object

Example fix

// before
_, err = client.UpdateCluster(ctx, cluster, status)
// after: run mutations outside the controller
// $ kops replace -f cluster.yaml
// controller only reads:
cluster, err := client.GetCluster(ctx, clusterPath)
Defensive patterns

Strategy: try-catch

Validate before calling

if isServerSideClientset(client) {
  return errors.New("UpdateCluster is not supported server-side; apply changes via kops CLI")
}

Try / catch

_, err := client.UpdateCluster(ctx, cluster, status)
if err != nil && strings.Contains(err.Error(), "UpdateCluster not supported") {
  // execute: kops replace -f cluster.yaml && kops update cluster --yes
  return applyViaKopsCLI(ctx, cluster)
}

Prevention

When it happens

Trigger: Calling client.UpdateCluster(ctx, cluster, status) from controller code, typically after GetCluster, attempting to persist spec or status changes to the state store.

Common situations: Porting CLI/upgrade logic (e.g. `kops update cluster` or status updating) into the controller; writing a reconciliation loop that tries to write back cluster changes.

Related errors


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