kubernetes/kops · error

building nodeConfig for instanceGroup: %w

Error message

building nodeConfig for instanceGroup: %w

What it means

getNodeConfig builds a nodeup.NodeConfig for a CAPI machine's instance group. When the configBuilder cannot produce bootstrap data for the instance group, the underlying error is wrapped with this message, indicating the failure happened while building nodeConfig for that instance group.

Source

Thrown at cmd/kops-controller/pkg/server/node_config.go:88

		configBuilder.InstanceGroupName = instanceGroupName
	} else {
		// Note: For now, we're assuming there is only a single cluster, and it is ours.
		// We therefore use the configured base path

		p := s.configBase.Join("igconfig", "node", instanceGroupName, "nodeupconfig.yaml")

		b, err := p.ReadFile(ctx)
		if err != nil {
			return nil, fmt.Errorf("error loading NodeupConfig %q: %v", p, err)
		}
		nodeConfig = &nodeup.NodeConfig{}
		nodeConfig.NodeupConfig = string(b)
	}

	if nodeConfig == nil {
		bootstrapData, err := configBuilder.GetBootstrapData(ctx)
		if err != nil {
			return nil, fmt.Errorf("building nodeConfig for instanceGroup: %w", err)
		}
		nodeupConfig, err := json.Marshal(bootstrapData.NodeupConfig)
		if err != nil {
			return nil, fmt.Errorf("marshalling nodeupConfig: %w", err)
		}
		nodeConfig = &nodeup.NodeConfig{}
		nodeConfig.NodeupConfig = string(nodeupConfig)
	}

	{
		secretIDs := []string{
			"dockerconfig",
		}
		nodeConfig.NodeSecrets = make(map[string][]byte)
		for _, id := range secretIDs {
			secret, err := s.secretStore.FindSecret(id)
			if err != nil {
				return nil, fmt.Errorf("error loading secret %q: %w", id, err)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped cause (%w) to identify the actual GetBootstrapData failure
  2. Verify --config-base points to valid, readable cluster state
  3. Re-run kops update/replace to regenerate the nodeup config
  4. Check keystore and secret store paths/permissions on the controller
Defensive patterns

Strategy: try-catch

Validate before calling

// verify cluster state reachable before bootstrap
if _, err := os.Stat(configBasePath); err != nil { return fmt.Errorf("config base unavailable: %w", err) }

Try / catch

nodeConfig, err := getNodeConfig(ctx, ...)
if err != nil {
    if strings.Contains(err.Error(), "building nodeConfig for instanceGroup") {
        klog.ErrorS(err, "bootstrap data build failed; check cluster state and keystore")
    }
    return err
}

Prevention

When it happens

Trigger: configBuilder.GetBootstrapData(ctx) returns any error (missing nodeup config, VFS/keystore read failure, malformed cluster state) while handling a bootstrap request that did not include an embedded nodeConfig.

Common situations: Cluster state in ConfigBase is incomplete or unreadable; nodeup config for the instance group was never generated; keystore/secret store misconfigured; operator changed ConfigBase after cluster creation.

Related errors


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