kubernetes/kops · error
must specify cloud
Error message
must specify cloud
What it means
addNodeController switches on opt.Cloud to pick a NodeIdentifier; when opt.Cloud is the empty string it returns the plain error "must specify cloud". kops-controller cannot choose a cloud-specific node identity provider without knowing the cloud, so startup fails fast.
Source
Thrown at cmd/kops-controller/main.go:377
identifier, err = nodeidentityscw.New(opt.CacheNodeidentityInfo)
if err != nil {
return fmt.Errorf("error building node identifier: %w", err)
}
case "metal":
identifier, err = nodeidentitymetal.New()
if err != nil {
return fmt.Errorf("error building metal node identifier: %w", err)
}
case "linode":
identifier, err = nodeidentitylinode.New(opt.CacheNodeidentityInfo)
if err != nil {
return fmt.Errorf("error building linode node identifier: %w", err)
}
case "":
return fmt.Errorf("must specify cloud")
default:
return fmt.Errorf("identifier for cloud %q not implemented", opt.Cloud)
}
nodeController, err := controllers.NewNodeReconciler(mgr, identifier)
if err != nil {
return err
}
if err := nodeController.SetupWithManager(mgr); err != nil {
return err
}
return nil
}
// Reconciler is the interface for a standard Reconciler.
type Reconciler interface {View on GitHub (pinned to 4c8573c808)
Solutions
- Add --cloud=<provider> (e.g. aws, gce, openstack, azure, hetzner, digitalocean, scaleway, metal, linode) to the kops-controller invocation
- If relying on the CLOUD environment variable, ensure it is set in the pod/container spec
- Re-deploy the controller with the complete flag set copied from a known-good configuration
Example fix
// before (pod args) args: - kops-controller - --config-dir=/etc/kubernetes/kops-controller/ // after args: - kops-controller - --cloud=aws - --config-dir=/etc/kubernetes/kops-controller/
Defensive patterns
Strategy: validation
Validate before calling
// validate args before launching
if opt.Cloud == "" {
log.Error(nil, "--cloud flag is required")
os.Exit(2)
} Try / catch
if err := addNodeController(context, opt); err != nil {
log.Error(err, "failed to add node controller")
os.Exit(1)
} Prevention
- Always set --cloud in kops-controller manifests; template it from cluster config
- Use a pre-start container script that asserts required flags are non-empty
- Copy flag sets from a known-good deployment when upgrading
When it happens
Trigger: Launching kops-controller without the --cloud flag and without CLOUD set in the environment, so options resolve Cloud to "".
Common situations: Deployment manifests (Deployment YAML, systemd unit, Helm values) missing the --cloud flag; environment variable not propagated into the container; operator upgraded kOps and dropped the flag from their run command.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- identifier for cloud %q not implemented
- clientset is not initialized
- error building metal node identifier: %w
- error building linode node identifier: %w
- kOps IPAM controller is not supported on cloud %q
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/cfdbf9051c359cb2.
Report an issue: GitHub.