kubernetes/kops · error

failed to get kind for object

Error message

failed to get kind for object

What it means

Wraps the Kind() lookup failure while grouping manifest objects by GroupKind for pruning. Fires when an object in the addon manifest cannot yield its kind, i.e. malformed object metadata that prevents classifying it for prune scoping.

Source

Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go:97

	neverPruneGroupKinds := map[schema.GroupKind]bool{
		{Group: "", Kind: "Namespace"}:                                    true,
		{Group: "apiextensions.k8s.io", Kind: "CustomResourceDefinition"}: true,
	}

	// Parse the manifest; we use this to scope pruning to namespaces
	objects, err := kubemanifest.LoadObjectsFrom(manifestData)
	if err != nil {
		return fmt.Errorf("failed to parse manifest: %w", err)
	}
	objectsByGK := make(map[schema.GroupKind][]*kubemanifest.Object)
	for _, object := range objects {
		gv, err := schema.ParseGroupVersion(object.APIVersion())
		if err != nil || gv.Version == "" {
			return fmt.Errorf("failed to parse apiVersion %q", object.APIVersion())
		}
		gvk := gv.WithKind(object.Kind())
		if gvk.Kind == "" {
			return fmt.Errorf("failed to get kind for object")
		}

		gk := gvk.GroupKind()
		objectsByGK[gk] = append(objectsByGK[gk], object)

		// Warn if there are objects in the manifest that we haven't considered
		if !pruneGroupKind[gk] {
			if !neverPruneGroupKinds[gk] {
				klog.Warningf("manifest includes an object of GroupKind %v, which will not be pruned", gk)
			}
		}
	}

	var groupKinds []schema.GroupKind
	for gk := range pruneGroupKind {
		groupKinds = append(groupKinds, gk)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Fix the kind field of the malformed object in the addon manifest
  2. Validate the manifest with kubectl dry-run before applying
  3. Correct or remove the offending manifest and re-run Normalize
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/pruning.go:97 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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