kubernetes/kops · critical
error creating KopsConfig controller: %w
Error message
error creating KopsConfig controller: %w
What it means
This error wraps failures from NewKopsConfigReconciler during RegisterControllers (pkg/controllers/clusterapi/register.go:27-29). The reconciler constructor calls ctrl.NewControllerManagedBy(mgr).For(&api.KopsConfig{}).Complete(r), so the error surfaces if the controller-runtime builder cannot set up watches for KopsConfig — most commonly because the KopsConfig CRD is not registered in the manager's scheme or the CRD is not installed in the cluster.
Source
Thrown at pkg/controllers/clusterapi/register.go:28
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package clusterapi
import (
"fmt"
"k8s.io/kops/pkg/client/simple"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
func RegisterControllers(mgr manager.Manager, clientset simple.Clientset) error {
if err := NewKopsConfigReconciler(mgr, clientset); err != nil {
return fmt.Errorf("error creating KopsConfig controller: %w", err)
}
if err := NewClusterReconciler(mgr); err != nil {
return fmt.Errorf("error creating Cluster controller: %w", err)
}
return nil
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Check the wrapped error: if it mentions 'no kind is registered' / 'no matches', the scheme lacks the KopsConfig type — ensure main registers kops v1beta1 bootstrap/controlplane types via AddToScheme before RegisterControllers.
- Install the kops cluster-api CRDs in the management cluster (apply the CRDs from the kops release / helm chart matching the controller version).
- Verify the controller image and CRD manifests are the same version — mismatched chart and binary cause scheme/CRD drift.
- Restart the controller after installing the CRDs; the manager performs a fresh discovery at startup.
- Confirm the manager is built with the correct scheme in main (scheme literal / clientgoscheme + kops AddToScheme calls).
Example fix
// before: scheme missing kops types in main
mgr, err := ctrl.NewManager(cfg, ctrl.Options{Scheme: scheme}) // scheme lacks kops bootstrap types
// after
if err := bootstrapv1.AddToScheme(scheme); err != nil { // api/v1beta1 (bootstrap.kops.k8s.io)
return err
}
mgr, err := ctrl.NewManager(cfg, ctrl.Options{Scheme: scheme}) Defensive patterns
Strategy: validation
Validate before calling
// Startup validation before RegisterControllers in main
scheme := runtime.NewScheme()
if err := clientgoscheme.AddToScheme(scheme); err != nil {
return err
}
if err := bootstrapkopsapi.AddToScheme(scheme); err != nil { // KopsConfig kind
return fmt.Errorf("kops bootstrap scheme not registered: %w", err)
}
// Verify CRDs exist in the cluster:
_, err := discoveryClient.ServerResourcesForGroupVersion("bootstrap.kops.k8s.io/v1beta1")
if err != nil {
return fmt.Errorf("KopsConfig CRD not installed in management cluster: %w", err)
} Try / catch
if err := RegisterControllers(mgr, clientset); err != nil {
setupLog.Error(err, "cannot register controllers — check scheme registration and installed CRDs")
os.Exit(1) // fail fast; do not run a manager with missing controllers
} Prevention
- Apply the kops cluster-api CRDs from the same release as the controller binary before deploying it.
- Register all kops v1beta1 AddToScheme calls in main's scheme literal setup and cover them with a smoke test.
- Keep controller image and CRD manifests versioned together (single helm chart / release artifact).
- Fail fast at startup (os.Exit on RegisterControllers error) so missing CRDs are caught immediately in CI/deploy pipelines.
- Add a readiness check asserting the controller's watches are established after manager start.
When it happens
Trigger: The kops v1beta1 API types are not added to the manager's scheme so Complete fails to build the controller for the unknown type; the KopsConfig CRD (bootstrap.kops.k8s.io) is not installed in the management cluster; the manager has not started / scheme is misconfigured in main.
Common situations: Deploying the kops cluster-api controller against a management cluster where the kops bootstrap provider CRDs were never applied (make release / helm chart skipped); a version mismatch where the controller binary expects CRDs (v1beta1) that the installed chart provides at a different version; running the controller binary outside the intended main entrypoint with a scheme lacking kops types.
Related errors
- error registering corev1: %v
- error registering kops/v1alpha2 API: %v
- error creating Cluster controller: %w
- unable to find resource for %s: %w
- error building corev1 client: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/724d0ec8da9fcbe0.
Report an issue: GitHub.