kubernetes/kops · error
expected exactly one Deployment in dns-controller manifest,
Error message
expected exactly one Deployment in dns-controller manifest, found %d
What it means
RemapAddonManifest parses the dns-controller addon manifest and collects its Deployment objects to rewrite image/versions. The addon is expected to ship exactly one Deployment; anything else means the manifest changed unexpectedly, so remapping aborts.
Source
Thrown at pkg/model/components/addonmanifests/dnscontroller/remap.go:47
// Remap remaps the dns-controller addon
func Remap(context *model.KopsModelContext, addon *addonsapi.AddonSpec, objects []*kubemanifest.Object) error {
if !context.UseServiceAccountExternalPermissions() {
return nil
}
var deployments []*kubemanifest.Object
for _, object := range objects {
if object.Kind() != "Deployment" {
continue
}
if object.APIVersion() != "apps/v1" {
continue
}
deployments = append(deployments, object)
}
if len(deployments) != 1 {
return fmt.Errorf("expected exactly one Deployment in dns-controller manifest, found %d", len(deployments))
}
podSpec := &corev1.PodSpec{}
if err := deployments[0].Reparse(podSpec, "spec", "template", "spec"); err != nil {
return fmt.Errorf("failed to parse spec.template.spec from Deployment: %v", err)
}
containers := podSpec.Containers
if len(containers) != 1 {
return fmt.Errorf("expected exactly one container in dns-controller Deployment, found %d", len(containers))
}
if err := iam.AddServiceAccountRole(&context.IAMModelContext, podSpec, &ServiceAccount{}); err != nil {
return err
}
if err := deployments[0].Set(podSpec, "spec", "template", "spec"); err != nil {
return errView on GitHub (pinned to 4c8573c808)
Solutions
- Restore the stock dns-controller addons manifest shipped with your kops version (do not hand-edit deployments count).
- Ensure the addon manifest file is complete and uncorrupted in your addons channel/location.
- Upgrade kops so the built-in manifest matches what Remap expects, then re-run `kops update cluster`.
Defensive patterns
Strategy: validation
Validate before calling
deployments := countDeployments(dnsControllerManifestYAML)
if deployments != 1 {
return fmt.Errorf("dns-controller manifest must contain exactly 1 Deployment, found %d", deployments)
} Prevention
- Do not hand-edit the bundled dns-controller addon manifest.
- Validate addon manifests with kubectl apply --dry-run=client before use.
- Use the addons bundle matching your kops version.
When it happens
Trigger: Applying `RemapAddonManifest` to a dns-controller addons.yaml that contains zero or multiple Deployment objects — e.g. after editing the manifest, using a custom/older addon bundle, or a parser that mis-scopes objects.
Common situations: Users hand-editing the dns-controller manifest adding extra Deployments; kops upgrade where the bundled addon format changed; a corrupted or truncated addons.yaml yielding no deployments.
Related errors
- failed to parse spec.template.spec from Deployment: %v
- expected exactly one container in dns-controller Deployment,
- error loading channel %q: %v
- error remapping manifest %s: %v
- unable to find manifest %s
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/b824d44f4b367bc8.
Report an issue: GitHub.