{"record":{"id":"175f5e57cba24eb6","repo":"kubernetes/kops","slug":"bare-metal-support-requires-the-metal-feature-flag","errorCode":null,"errorMessage":"bare-metal support requires the Metal feature flag to be enabled","messagePattern":"bare-metal support requires the Metal feature flag to be enabled","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/toolbox_enroll.go","lineNumber":90,"sourceCode":"\tSSHPort int\n\n\t// BuildHost is a flag to only build the host resource, don't apply it or enroll the node\n\tBuildHost bool\n\n\t// PodCIDRs is the list of IP Address ranges to use for pods that run on this node\n\tPodCIDRs []string\n\n\tkubeconfig.CreateKubecfgOptions\n}\n\nfunc (o *ToolboxEnrollOptions) InitDefaults() {\n\to.SSHUser = \"root\"\n\to.SSHPort = 22\n}\n\nfunc RunToolboxEnroll(ctx context.Context, f commandutils.Factory, out io.Writer, options *ToolboxEnrollOptions) error {\n\tif !featureflag.Metal.Enabled() {\n\t\treturn fmt.Errorf(\"bare-metal support requires the Metal feature flag to be enabled\")\n\t}\n\tif options.ClusterName == \"\" {\n\t\treturn fmt.Errorf(\"cluster is required\")\n\t}\n\tif options.InstanceGroup == \"\" {\n\t\treturn fmt.Errorf(\"instance-group is required\")\n\t}\n\tif options.Host == \"\" {\n\t\t// Technically we could build the host resource without the PKI, but this isn't the case we are targeting right now.\n\t\treturn fmt.Errorf(\"host is required\")\n\t}\n\n\t// Resolve KOPS_BASE_URL early so that kops.Version is overridden\n\t// before the version downgrade check in ApplyClusterCmd.Run.\n\tif _, err := wellknownassets.BaseURL(); err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/commands/toolbox_enroll.go#L72-L108","documentation":"`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.","triggerScenarios":"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)`).","commonSituations":"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.","solutions":["Enable the flag: `export KOPS_FEATURE_FLAGS=Metal` (or `kops set feature-flags Metal=true`) and re-run the command","If your kops version has graduated Metal to default-on, upgrade kops; if it was removed, the command may be unavailable in your build","Confirm the binary you run is the one you configured (check `kops version` and env in the shell)"],"exampleFix":"// before\nkops toolbox enroll --cluster c.example.com --instance-group metal --host 10.0.0.5\n// after\nexport KOPS_FEATURE_FLAGS=Metal\nkops toolbox enroll --cluster c.example.com --instance-group metal --host 10.0.0.5","handlingStrategy":"validation","validationCode":"// before invoking enroll\ndetect() { kops toolbox enroll --help >/dev/null 2>&1; }\n[ \"${KOPS_FEATURE_FLAGS#*Metal}\" != \"${KOPS_FEATURE_FLAGS}\" ] || export KOPS_FEATURE_FLAGS=\"${KOPS_FEATURE_FLAGS:+$KOPS_FEATURE_FLAGS,}Metal\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set KOPS_FEATURE_FLAGS=Metal in shell profile or CI env for bare-metal jobs","Check feature flag status with `kops get cluster`/docs for your kops version","Gate scripts on the flag and fail early with a clear message"],"tags":["feature-flag","bare-metal","cli"],"backgroundTag":"feature-flag-disabled","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}