kubernetes/kops · error

ConfigLocation is required

Error message

ConfigLocation is required

What it means

NodeUpCommand requires a ConfigLocation pointing at its boot config file; without it there is no way to obtain the BootConfig (there is no default path). Run returns this immediately when the ConfigLocation field is empty. It is a programmer/CLI-usage error, not an environmental one.

Source

Thrown at upup/pkg/fi/nodeup/command.go:100

}

// Run is responsible for perform the nodeup process
func (c *NodeUpCommand) Run(out io.Writer) error {
	ctx := context.Background()

	var bootConfig nodeup.BootConfig
	if c.ConfigLocation != "" {
		b, err := vfs.Context.ReadFile(c.ConfigLocation)
		if err != nil {
			return fmt.Errorf("error loading configuration %q: %v", c.ConfigLocation, err)
		}

		err = utils.YamlUnmarshal(b, &bootConfig)
		if err != nil {
			return fmt.Errorf("error parsing configuration %q: %v", c.ConfigLocation, err)
		}
	} else {
		return fmt.Errorf("ConfigLocation is required")
	}

	if c.CacheDir == "" {
		return fmt.Errorf("CacheDir is required")
	}

	region, err := getRegion(ctx, &bootConfig)
	if err != nil {
		return err
	}

	var configBase vfs.Path

	// If we're using a config server instead of vfs, nodeConfig will hold our configuration
	var nodeConfig *nodeup.NodeConfig

	if bootConfig.ConfigServer != nil && len(bootConfig.ConfigServer.Servers) > 0 {
		response, err := getNodeConfigFromServers(ctx, &bootConfig, region)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Pass --config <vfs-path-to-nodeupconfig> when invoking the nodeup binary
  2. Set NodeUpCommand.ConfigLocation in code before calling Run
  3. If you author user-data, ensure the templated config path is populated (not empty) at instance launch
  4. Verify the generated launch configuration/user-data includes the config argument

Example fix

// before
nodeup location=... (no --config flag)
// after
nodeup --config s3://bucket/cluster.example.com/config/nodeupconfig --cachedir /var/cache/nodeup
Defensive patterns

Strategy: validation

Validate before calling

if cfg.ConfigLocation == "" {
  return errors.New("nodeup requires --config pointing at the nodeupconfig VFS path")
}

Type guard

func configReady(cmd *NodeUpCommand) bool { return cmd.ConfigLocation != "" }

Try / catch

if err := cmd.Run(os.Stdout); err != nil {
  if err.Error() == "ConfigLocation is required" {
    klog.Error("nodeup invoked without --config; fix the user-data/systemd unit")
    os.Exit(2)
  }
  return err
}

Prevention

When it happens

Trigger: Invoking nodeup without the --config flag, or constructing NodeUpCommand in code without setting ConfigLocation.

Common situations: Hand-written systemd unit or launch-template user-data omitting the --config argument; custom tooling building NodeUpCommand structurally and forgetting the field; a regression in the code that renders nodeup's user-data.

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


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