kubernetes/kops · error

error building kube-apiserver flags: %v

Error message

error building kube-apiserver flags: %v

What it means

Wraps a failure of the flag-building helper in buildPod: the kube-apiserver command-line flags (including the admission-controller fixups) could not be constructed from the APIServerConfig, so the pod spec cannot be completed.

Source

Thrown at nodeup/pkg/model/kube_apiserver.go:628

	// @fixup: the admission controller migrated from --admission-control to --enable-admission-plugins, but
	// most people will still have c.Spec.KubeAPIServer.AdmissionControl references into their configuration we need
	// to fix up. A PR https://github.com/kubernetes/kops/pull/5221/ introduced the issue and since the command line
	// flags are mutually exclusive the API refuses to come up.
	{
		// @note: note sure if this is the best place to put it, I could place into the validation.go which has the benefit of
		// fixing up the manifests itself, but that feels VERY hacky
		// @note: it's fine to use AdmissionControl here and it's not populated by the model, thus the only data could have come from the cluster spec
		if len(kubeAPIServer.AdmissionControl) > 0 {
			kubeAPIServer.EnableAdmissionPlugins = append([]string(nil), kubeAPIServer.AdmissionControl...)
			kubeAPIServer.AdmissionControl = []string{}
		}
	}

	// build the kube-apiserver flags for the service
	flags, err := flagbuilder.BuildFlagsList(kubeAPIServer)
	if err != nil {
		return nil, fmt.Errorf("error building kube-apiserver flags: %v", err)
	}

	pod := &v1.Pod{
		TypeMeta: metav1.TypeMeta{
			APIVersion: "v1",
			Kind:       "Pod",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name:        "kube-apiserver",
			Namespace:   "kube-system",
			Annotations: b.buildAnnotations(),
			Labels: map[string]string{
				"k8s-app": "kube-apiserver",
			},
		},
		Spec: v1.PodSpec{
			HostNetwork: true,
		},

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check kubeAPIServer flag settings in the cluster spec
  2. Remove deprecated admission-control settings
  3. Re-run nodeup after spec fixes
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at nodeup/pkg/model/kube_apiserver.go:628 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/7539b13840a4abfb. Report an issue: GitHub.