kubernetes/kops · error
failed to initialize the ingress controller, error: %v
Error message
failed to initialize the ingress controller, error: %v
What it means
Wraps a failure of watchers.NewIngressController during dns-controller startup when --watch-ingress is enabled. The ingress watcher could not be constructed, so the DNS controller cannot start watching ingress resources.
Source
Thrown at dns-controller/cmd/dns-controller/main.go:175
if err != nil {
return fmt.Errorf("failed to initialize the node controller, error: %v", err)
}
podController, err := watchers.NewPodController(client, dnsctl, namespace)
if err != nil {
return fmt.Errorf("failed to initialize the pod controller, error: %v", err)
}
serviceController, err := watchers.NewServiceController(client, dnsctl, namespace)
if err != nil {
return fmt.Errorf("failed to initialize the service controller, error: %v", err)
}
var ingressController *watchers.IngressController
if watchIngress {
ingressController, err = watchers.NewIngressController(client, dnsctl, namespace)
if err != nil {
return fmt.Errorf("failed to initialize the ingress controller, error: %v", err)
}
} else {
klog.Infof("Ingress controller disabled")
}
go nodeController.Run()
go podController.Run()
go serviceController.Run()
if watchIngress {
go ingressController.Run()
}
return nil
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Read the wrapped inner error to identify the constructor failure.
- If ingress records are not needed, drop --watch-ingress to skip this controller entirely.
- Verify RBAC permissions for ingresses and a compatible Kubernetes API server version.
Example fix
// before dns-controller --watch-ingress --kubernetes=... // fails in restricted env // after dns-controller --kubernetes=... // ingress controller disabled
Defensive patterns
Strategy: try-catch
Validate before calling
if watchIngress && client == nil {
return errors.New("cannot watch ingress without an initialized kubernetes client")
} Type guard
func ingressWatchReady(watchIngress bool, client kubernetes.Interface) bool {
return !watchIngress || client != nil
} Try / catch
if err := initializeWatchers(client, dnsctl, ns, watchIngress, types); err != nil {
klog.Fatalf("failed to init watchers: %v", err)
} Prevention
- Only pass --watch-ingress when ingress DNS records are actually required.
- Grant ingress list/watch RBAC before enabling the flag.
- Confirm the cluster's API server supports networking.k8s.io/v1 ingresses.
When it happens
Trigger: Running with --watch-ingress=true and NewIngressController receives invalid inputs (nil client, nil dnsctl, bad namespace) and errors out.
Common situations: Ingress watching enabled against an environment where the client can't access networking.k8s.io resources; invalid namespace flag; older Kubernetes API version without needed ingress support.
Related errors
- failed to initialize the node controller, error: %v
- failed to initialize the pod controller, error: %v
- failed to initialize the service controller, error: %v
- error initializing DNS cache: %v
- error building dns scope: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/5febbcf09df2980f.
Report an issue: GitHub.