kubernetes/kops · error
invalid value %q for --instance-manager
Error message
invalid value %q for --instance-manager
What it means
kops validates the --instance-manager flag during cluster creation. When the value supplied is not one of the supported instance managers (e.g. 'karpenter', 'cloudgroups'), NewCluster aborts with this message. It is a CLI/config input validation guard, not a runtime fault.
Source
Thrown at upup/pkg/fi/cloudup/new_cluster.go:487
switch opt.InstanceManager {
case "karpenter":
if opt.DiscoveryStore == "" {
return nil, fmt.Errorf("karpenter requires --discovery-store")
}
cluster.Spec.Karpenter = &api.KarpenterConfig{
Enabled: true,
}
nodes, err = setupKarpenterNodes(opt)
if err != nil {
return nil, err
}
case "cloudgroups":
nodes, err = setupNodes(opt, cluster, zoneToSubnetsMap)
if err != nil {
return nil, err
}
default:
return nil, fmt.Errorf("invalid value %q for --instance-manager", opt.InstanceManager)
}
apiservers, err := setupAPIServers(opt, cluster, zoneToSubnetsMap)
if err != nil {
return nil, err
}
err = setupAPI(opt, cluster)
if err != nil {
return nil, err
}
instanceGroups := append([]*api.InstanceGroup(nil), controlPlanes...)
instanceGroups = append(instanceGroups, apiservers...)
instanceGroups = append(instanceGroups, nodes...)
instanceGroups = append(instanceGroups, bastions...)
for _, instanceGroup := range instanceGroups {View on GitHub (pinned to 4c8573c808)
Solutions
- Check supported values with `kops create cluster --help` and pass one exactly (e.g. --instance-manager=karpenter for AWS).
- If the value is a feature-flagged manager, enable the required feature flag first: `export KOPS_FEATURE_FLAGS=<flag>` and retry.
- Omit the flag entirely to use the default instance manager for the cloud provider.
- Upgrade kops if the desired value only exists in a newer release.
Example fix
// before kops create cluster --name=example.com --instance-manager=karpentr // after kops create cluster --name=example.com --instance-manager=karpenter
Defensive patterns
Strategy: validation
Validate before calling
valid := map[string]bool{"cloudgroups": true, "karpenter": true}
if em := flagInstanceManager; em != "" && !valid[em] {
return fmt.Errorf("unsupported --instance-manager %q; see 'kops create cluster --help'", em)
} Type guard
func isValidInstanceManager(v string) bool {
switch v {
case "cloudgroups", "karpenter":
return true
}
return false
} Try / catch
ig, err := NewCluster(opt, cluster, zoneToSubnetsMap)
if err != nil {
if strings.Contains(err.Error(), "invalid value") && strings.Contains(err.Error(), "--instance-manager") {
return fmt.Errorf("bad --instance-manager flag: %w (allowed: cloudgroups, karpenter)", err)
}
return err
} Prevention
- List allowed values with `kops create cluster --help` before passing the flag
- Copy flag values from the docs matching your exact kops version
- Script flag values via constants, not free-typed strings
When it happens
Trigger: Running `kops create cluster --instance-manager <bad-value>` where the value is misspelled, unsupported for the chosen cloud provider, or copied from docs for a different kops version.
Common situations: Typo like --instance-manager=karpentr; using a value enabled only behind a feature flag or on a specific cloud (e.g. karpenter on AWS only); following an outdated tutorial.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- spec.PublicKey is required
- adding keypair to %q is not supported
- unable to parse YAML %v: %v
- error adding SSH public key: %v
- parsing file %q: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/7378de55ca303907.
Report an issue: GitHub.