Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The error means kubeadm found a configuration key that is not valid for the document’s apiVersion and kind, or that the key is nested under the wrong parent. Match the file to your installed kubeadm version, put each setting in the right configuration object, and rerun kubeadm init.

What the unknown-field error means

When kubeadm reads YAML, it converts the document for JSON decoding and validates its fields against the schema for that document’s apiVersion and kind. An error such as json: unknown field "metadata" or json: unknown field "spec" means the key is not accepted in that location. A key can be valid in a Kubernetes resource manifest but invalid in a kubeadm configuration object.

This is a configuration schema or placement problem. It occurs before kubeadm can proceed with cluster creation; it does not, by itself, identify a networking or runtime failure.

Fix the configuration in order

  1. Check the installed release by running kubeadm version. The supported configuration API depends on the kubeadm binary that will run init.

    Free tools Windows power users keep installed

    One-click scans. No signup required.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    #1 Best Overall
  2. Set apiVersion to one supported by that binary. The current kubeadm configuration reference describes kubeadm.k8s.io/v1beta4 and notes that v1beta3 is deprecated in favor of v1beta4, with removal expected in a future release, 1.34 or later. Kubernetes’ configuration migration guidance says kubeadm v1.22 and newer no longer support v1beta1 and older, while v1.27 and newer no longer support v1beta2 and older. Check the reference for your installed release rather than copying a version from an unrelated example.

  3. Generate a starting point using kubeadm config print init-defaults, then edit that output instead of treating a generic Kubernetes manifest as a kubeadm file. The kubeadm configuration reference recommends supplying configuration with the --config option.

  4. Check every field against its object and parent in the matching API reference. kubeadm configuration can include multiple documents separated by ---. For kubeadm init --config, the supported types include InitConfiguration, ClusterConfiguration, KubeProxyConfiguration, and KubeletConfiguration; only one of InitConfiguration and ClusterConfiguration is mandatory, according to the configuration reference.

  5. Separate node-specific settings from cluster-wide settings as shown below, then rerun kubeadm init --config kubeadm.yaml.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put settings in the right kubeadm object

Node-specific initialization settings

Use InitConfiguration for settings tied to the node being initialized, including nodeRegistration, criSocket, node IP, and localAPIEndpoint.advertiseAddress. The kubeadm API reference defines the fields for this object.

Cluster-wide settings and the pod network CIDR

Use ClusterConfiguration for cluster-wide settings such as networking, etcd, and control-plane component customization. The pod network range goes at ClusterConfiguration.networking.podSubnet, not at the document’s top level. The API reference defines podSubnet as the subnet used by Pods; its example uses 10.244.0.0/24. Choose a range suitable for your cluster and network setup.

API-server customization

For kubeadm-supported API-server customization, use fields such as apiServer.extraArgs or apiServer.extraVolumes as defined by the matching reference. Do not paste a generic Kubernetes object’s spec beneath ClusterConfiguration.apiServer; that parent does not accept an arbitrary spec block.

Example layout for a multi-document configuration

This illustrates where common settings belong. The API version and availability of individual fields must match the installed kubeadm release; the example is not a guarantee that every release accepts every field.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
apiVersion: kubeadm.k8s.io/v1beta4  # use a version supported by your kubeadm binary
kind: InitConfiguration
nodeRegistration:
  criSocket: unix:///run/containerd/containerd.sock
localAPIEndpoint:
  advertiseAddress: 192.0.2.10
---
apiVersion: kubeadm.k8s.io/v1beta4
kind: ClusterConfiguration
networking:
  podSubnet: 10.244.0.0/16
  serviceSubnet: 10.96.0.0/12
apiServer:
  extraArgs:
    authorization-mode: Node,RBAC

In this layout, the first document contains node initialization settings and the second contains cluster settings. The --- separator marks the start of another YAML document.

Choose flags or a configuration file

Approach Best fit Trade-offs
Command-line flags A simple, one-off setting Quick for a small invocation, but less convenient to repeat across multiple settings or rebuilds.
Version-matched YAML file Repeatable setup or configuration across multiple components Centralizes settings and can be reused, but its API version and fields must remain compatible with the kubeadm binary.

Kubernetes describes a YAML file passed with --config as the preferred way to configure kubeadm. For a short-lived invocation with only a simple setting, flags may be more direct; for repeatable or multi-component configuration, a version-matched file makes the object boundaries explicit.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

If the error remains

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.