{"record":{"id":"67eb927f5a410200","repo":"kubernetes/kops","slug":"expected-exactly-one-container-in-etcd-manager-pod-67eb92","errorCode":null,"errorMessage":"expected exactly one container in etcd-manager Pod, found %d","messagePattern":"expected exactly one container in etcd-manager Pod, found (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/components/kubeapiserver/model.go","lineNumber":136,"sourceCode":"\n\tvar pod *corev1.Pod\n\tvar container *corev1.Container\n\t{\n\t\tobjects, err := model.ParseManifest(manifest)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(objects) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"expected exactly one object in manifest %s, found %d\", bundle, len(objects))\n\t\t}\n\t\tif podObject, ok := objects[0].(*corev1.Pod); !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected Pod object in manifest %s, found %T\", bundle, objects[0])\n\t\t} else {\n\t\t\tpod = podObject\n\t\t}\n\n\t\tif len(pod.Spec.Containers) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"expected exactly one container in etcd-manager Pod, found %d\", len(pod.Spec.Containers))\n\t\t}\n\t\tcontainer = &pod.Spec.Containers[0]\n\t}\n\n\t// Remap image via AssetBuilder\n\tcontainer.Image = b.AssetBuilder.RemapImage(container.Image)\n\n\treturn pod, nil\n}\n","sourceCodeStart":118,"sourceCodeEnd":146,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/components/kubeapiserver/model.go#L118-L146","documentation":"buildHealthcheckSidecar requires the etcd-manager healthcheck Pod template to contain exactly one container so it can inject the sidecar and remap its image via AssetBuilder. If pod.Spec.Containers has any count other than 1, it fails with this error. Like the previous checks, this validates the integrity of the embedded bundle template.","triggerScenarios":"kops update cluster where the embedded sidecar Pod template defines 0 or multiple containers — corrupted or hand-edited bundle in a custom kOps build.","commonSituations":"Custom builds with edited pod templates, or upstream regressions changing the bundled template shape.","solutions":["Use an official kOps release where the sidecar Pod template has exactly one container","Fix the custom bundle so the Pod has a single container","Diff your bundle against the upstream one to spot added/removed containers","Upgrade kOps if an upstream regression changed the template"],"exampleFix":"// before (bundle Pod spec)\ncontainers:\n- name: etcd-manager\n- name: extra\n// after\ncontainers:\n- name: etcd-manager","handlingStrategy":"validation","validationCode":"// Check container count in the sidecar Pod before model build\npod, err := asPod(objects[0])\nif err != nil || pod == nil {\n    return fmt.Errorf(\"bundle is not a Pod\")\n}\nif len(pod.Spec.Containers) != 1 {\n    return fmt.Errorf(\"sidecar Pod must have exactly one container, got %d\", len(pod.Spec.Containers))\n}","typeGuard":null,"tryCatchPattern":"pod, err := buildHealthcheckSidecar(ctx, b, bundle)\nif err != nil {\n    if strings.Contains(err.Error(), \"expected exactly one container\") {\n        return fmt.Errorf(\"sidecar bundle template changed — use official kOps: %w\", err)\n    }\n    return err\n}","preventionTips":["Keep the sidecar Pod template single-container","Re-diff bundles after every upstream kOps merge in forks","Add a unit test asserting len(pod.Spec.Containers) == 1 on the bundle"],"tags":["kube-apiserver","healthcheck","pod-template"],"backgroundTag":"unexpected-container-count","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"}