kubernetes/kubernetes · error

failed to init resource claim controller: %w

Error message

failed to init resource claim controller: %w

What it means

Thrown in newResourceClaimController (resource.go:92) when resourceclaim.NewController returns an error during KCM controller startup. NewController validates its inputs (client, Pods/PodGroups/ResourceClaims/ResourceClaimTemplates informers) and fails if, e.g., the PodGroup informer API group is unavailable or the DRA types are not registered. The %w preserves the underlying cause for inspection.

Source

Thrown at cmd/kube-controller-manager/app/resource.go:92

		},
	}
}

func newResourceClaimController(ctx context.Context, controllerContext ControllerContext, controllerName string) (Controller, error) {
	client, err := controllerContext.NewClient("resource-claim-controller")
	if err != nil {
		return nil, err
	}

	controller, err := resourceclaim.NewController(
		klog.FromContext(ctx),
		client,
		controllerContext.InformerFactory.Core().V1().Pods(),
		controllerContext.InformerFactory.Scheduling().V1beta1().PodGroups(),
		controllerContext.InformerFactory.Resource().V1().ResourceClaims(),
		controllerContext.InformerFactory.Resource().V1().ResourceClaimTemplates())
	if err != nil {
		return nil, fmt.Errorf("failed to init resource claim controller: %w", err)
	}

	return newControllerLoop(func(ctx context.Context) {
		controller.Run(ctx, int(controllerContext.ComponentConfig.ResourceClaimController.ConcurrentSyncs))
	}, controllerName), nil
}

func newResourcePoolStatusRequestControllerDescriptor() *ControllerDescriptor {
	return &ControllerDescriptor{
		name:        names.ResourcePoolStatusRequestController,
		constructor: newResourcePoolStatusRequestController,
		requiredFeatureGates: []featuregate.Feature{
			features.DRAResourcePoolStatus,
		},
	}
}

func newResourcePoolStatusRequestController(ctx context.Context, controllerContext ControllerContext, controllerName string) (Controller, error) {

View on GitHub (pinned to b882c60b40)

Solutions

  1. Ensure the cluster API server serves the Scheduling v1beta1 PodGroups and Resource v1 ResourceClaims/ResourceClaimTemplates APIs.
  2. Confirm the DynamicResourceAllocation feature gate is enabled on both API server and KCM.
  3. Inspect the wrapped %w error for the specific list/watch or type-registration failure and address it.
  4. If DRA is not needed, disable the controller: --controllers=-resourceclaim-controller.

Example fix

// before: DRA enabled but PodGroups API absent
// after: install/enable PodGroups API or disable the controller
--feature-gates=DynamicResourceAllocation=false --controllers=-resourceclaim-controller
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the DRA APIs are served before enabling the controller
groups, err := discoveryClient.ServerResourcesForGroupVersion("resource.k8s.io/v1")
if err != nil { /* DRA API missing; do not enable controller */ }

Try / catch

controller, err := resourceclaim.NewController(logger, client, podsInf, podGroupsInf, claimsInf, templatesInf)
if err != nil {
    return nil, fmt.Errorf("failed to init resource claim controller: %w", err)
}

Prevention

When it happens

Trigger: Starting KCM with the resource-claim controller enabled (DynamicResourceAllocation feature gate on) in an environment where the Scheduling v1beta1 PodGroups API or Resource v1 ResourceClaims/ResourceClaimTemplates APIs are not installed/available, or where the informer factory cannot list/watch those resources.

Common situations: Enabling DRA on a cluster whose API server lacks the required API groups (e.g. a custom API server build, or a version mismatch); missing CRD installation for PodGroups; the informer factory was constructed without registering the resource API.

Related errors


AI-assisted analysis of kubernetes/kubernetes@b882c60b40 (2026-08-07). Data as JSON: /api/errors/6c51af0cf721aca8. Report an issue: GitHub.