kubernetes/kops · error

bare-metal support requires the Metal feature flag to be ena

Error message

bare-metal support requires the Metal feature flag to be enabled

What it means

`kops toolbox enroll` enrolls a bare-metal machine into a cluster, an experimental capability gated behind the `Metal` feature flag. The command refuses to run unless `featureflag.Metal` is enabled, so users who invoke it on a default configuration always get this error first.

Source

Thrown at pkg/commands/toolbox_enroll.go:90

	SSHPort int

	// BuildHost is a flag to only build the host resource, don't apply it or enroll the node
	BuildHost bool

	// PodCIDRs is the list of IP Address ranges to use for pods that run on this node
	PodCIDRs []string

	kubeconfig.CreateKubecfgOptions
}

func (o *ToolboxEnrollOptions) InitDefaults() {
	o.SSHUser = "root"
	o.SSHPort = 22
}

func RunToolboxEnroll(ctx context.Context, f commandutils.Factory, out io.Writer, options *ToolboxEnrollOptions) error {
	if !featureflag.Metal.Enabled() {
		return fmt.Errorf("bare-metal support requires the Metal feature flag to be enabled")
	}
	if options.ClusterName == "" {
		return fmt.Errorf("cluster is required")
	}
	if options.InstanceGroup == "" {
		return fmt.Errorf("instance-group is required")
	}
	if options.Host == "" {
		// Technically we could build the host resource without the PKI, but this isn't the case we are targeting right now.
		return fmt.Errorf("host is required")
	}

	// Resolve KOPS_BASE_URL early so that kops.Version is overridden
	// before the version downgrade check in ApplyClusterCmd.Run.
	if _, err := wellknownassets.BaseURL(); err != nil {
		return err
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Enable the flag: `export KOPS_FEATURE_FLAGS=Metal` (or `kops set feature-flags Metal=true`) and re-run the command
  2. If your kops version has graduated Metal to default-on, upgrade kops; if it was removed, the command may be unavailable in your build
  3. Confirm the binary you run is the one you configured (check `kops version` and env in the shell)

Example fix

// before
kops toolbox enroll --cluster c.example.com --instance-group metal --host 10.0.0.5
// after
export KOPS_FEATURE_FLAGS=Metal
kops toolbox enroll --cluster c.example.com --instance-group metal --host 10.0.0.5
Defensive patterns

Strategy: validation

Validate before calling

// before invoking enroll
detect() { kops toolbox enroll --help >/dev/null 2>&1; }
[ "${KOPS_FEATURE_FLAGS#*Metal}" != "${KOPS_FEATURE_FLAGS}" ] || export KOPS_FEATURE_FLAGS="${KOPS_FEATURE_FLAGS:+$KOPS_FEATURE_FLAGS,}Metal"

Prevention

When it happens

Trigger: Running `kops toolbox enroll ...` without first enabling the feature flag via `export KOPS_FEATURE_FLAGS=Metal` or `kops set feature-flags Metal=true` (or programmatically `featureflag.Metal.Set(true)`).

Common situations: Trying out bare-metal enrollment on a stock kops build where Metal is still alpha/beta; CI environments that don't persist the KOPS_FEATURE_FLAGS env var between steps.

Related errors


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