{"record":{"id":"57b0ed72179a9313","repo":"kubernetes/kops","slug":"applying-object-to-cluster-w","errorCode":null,"errorMessage":"applying object to cluster: %w","messagePattern":"applying object to cluster: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/controllers/clusterapi/cluster_controller.go","lineNumber":335,"sourceCode":"\t}\n\n\t// TODO: Sync with LinkToNetwork\n\tobj := map[string]any{\n\t\t\"apiVersion\": \"controlplane.cluster.x-k8s.io/v1beta1\",\n\t\t\"kind\":       \"KopsControlPlane\",\n\t\t\"metadata\": map[string]any{\n\t\t\t\"name\":      name,\n\t\t\t\"namespace\": s.namespace(),\n\t\t},\n\t\t\"spec\": map[string]any{},\n\t}\n\n\tu := &unstructured.Unstructured{Object: obj}\n\n\t// setOwnerRef(u, s.Cluster)\n\n\tif err := s.ssa(ctx, kube, u); err != nil {\n\t\treturn fmt.Errorf(\"applying object to cluster: %w\", err)\n\t}\n\n\t// TODO: Sync with LinkToNetwork\n\tstatusObj := map[string]any{\n\t\t\"apiVersion\": \"controlplane.cluster.x-k8s.io/v1beta1\",\n\t\t\"kind\":       \"KopsControlPlane\",\n\t\t\"metadata\": map[string]any{\n\t\t\t\"name\":      name,\n\t\t\t\"namespace\": s.namespace(),\n\t\t},\n\t\t\"status\": status,\n\t}\n\n\tif err := s.ssaStatus(ctx, kube, &unstructured.Unstructured{Object: statusObj}); err != nil {\n\t\treturn fmt.Errorf(\"applying object to cluster: %w\", err)\n\t}\n\n\ts.capiControlPlane = u","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/controllers/clusterapi/cluster_controller.go#L317-L353","documentation":"createKopsControlPlane applies the KopsControlPlane custom resource (controlplane.cluster.x-k8s.io/v1beta1) via server-side apply. This error wraps a failure of that Patch: typically the KopsControlPlane CRD is not installed, RBAC denies the apply, or the API server rejects the object.","triggerScenarios":"The controlplane.cluster.x-k8s.io/v1beta1 CRD is missing from the management cluster (no matches for kind); the controller's ServiceAccount lacks patch permission on kopscontrolplanes; the object fails validation; API server connectivity failure.","commonSituations":"Deploying the kops CAPI controller before installing/upgrading the kops CAPI CRDs; CRD version drift after a cluster-api upgrade; incomplete RBAC manifests in the Helm/manifest install.","solutions":["Install or update the kops controlplane.cluster.x-k8s.io/v1beta1 CRDs on the management cluster","Grant RBAC patch/update on kopscontrolplanes.resources in the controller role","Check the wrapped error: 'no matches for kind' → CRD missing; Forbidden → RBAC; otherwise API-server validation detail","Verify CRD apiVersion compatibility with the installed kops CAPI controller version"],"exampleFix":"# before\n# CRDs not installed: kubectl apply fails with 'no matches for kind \"KopsControlPlane\"'\n# after\nkubectl apply -f clusterapi/controlplane/kops/config/crd/bases/","handlingStrategy":"validation","validationCode":"// pre-flight: ensure CRD is installed\nkubectl get crd kopscontrolplanes.controlplane.cluster.x-k8s.io\n# expect: Established=True","typeGuard":null,"tryCatchPattern":"if err := s.ssa(ctx, kube, u); err != nil {\n    if apierrors.IsNotFound(err) || strings.Contains(err.Error(), \"no matches for kind\") {\n        klog.Errorf(\"KopsControlPlane CRD not installed: %v\", err)\n    }\n    return fmt.Errorf(\"applying object to cluster: %w\", err)\n}","preventionTips":["Install kops CAPI CRDs before deploying the controller","Keep CRD and controller versions in lockstep","Add a preflight CRD check to the deployment pipeline","Watch for 'no matches for kind' in controller logs after upgrades"],"tags":["crd","server-side-apply","kubernetes","rbac"],"backgroundTag":"crd-missing","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}