KubeGlanceDownload
Kubernetes 1.37: unknown flag --containerd, and the cAdvisor metrics that went with it

troubleshooting

Kubernetes 1.37: unknown flag --containerd, and the cAdvisor metrics that went with it

Kubelet 1.37 exits with failed to parse kubelet flag: unknown flag: --containerd. The 18 removed cAdvisor flags, 3 lost metrics, and how to check first.

· 11 min read

Kubernetes 1.37 swapped the kubelet’s embedded cAdvisor for the smaller github.com/google/cadvisor/lib module, and dropped three things with it. Eighteen cAdvisor flags, most of them deprecated since 1.10, are now unknown flags, so a kubelet started with any of them exits before it does anything else and its node goes NotReady. Three series disappear from /metrics/cadvisor, and cAdvisor’s custom application metrics disappear from both /metrics/cadvisor and /stats/summary.

There is a fourth consequence that the release note does not mention. One of the eighteen, --containerd, was the only way to tell cAdvisor where containerd’s socket is. Delete it to get the kubelet running on a node whose socket is not at /run/containerd/containerd.sock, and every per-container series in /metrics/cadvisor loses its pod, namespace and container labels. The node is Ready, kubectl top works, and your Grafana panels go flat.

What it looks like

On a 1.37.0 kind node, with --containerd=/run/containerd/containerd.sock added to KUBELET_EXTRA_ARGS and the kubelet restarted, the journal holds one line per attempt:

journalctl -u kubelet --no-pager
Sep 30 07:43:14 glance-k137-worker2 systemd[1]: Started kubelet.service - kubelet: The Kubernetes Node Agent.
Sep 30 07:43:14 glance-k137-worker2 kubelet[783]: E0930 07:43:14.393677     783 run.go:72] "command failed" err="failed to parse kubelet flag: unknown flag: --containerd"
Sep 30 07:43:14 glance-k137-worker2 systemd[1]: kubelet.service: Main process exited, code=exited, status=1/FAILURE
Sep 30 07:43:14 glance-k137-worker2 systemd[1]: kubelet.service: Failed with result 'exit-code'.
Sep 30 07:43:15 glance-k137-worker2 systemd[1]: kubelet.service: Scheduled restart job, restart counter is at 1.
Sep 30 07:43:15 glance-k137-worker2 systemd[1]: Started kubelet.service - kubelet: The Kubernetes Node Agent.
Sep 30 07:43:15 glance-k137-worker2 kubelet[807]: E0930 07:43:15.483761     807 run.go:72] "command failed" err="failed to parse kubelet flag: unknown flag: --containerd"

Nothing else. No version banner, no config dump, no attempt to reach the API server. kind’s unit restarts the kubelet every second, and by the time I looked systemd had counted 74 restarts. From the API side the node looks like any node whose kubelet has died. Polled every ten seconds:

kubectl get node glance-k137-worker2 --no-headers
glance-k137-worker2   Ready   <none>   5m28s   v1.37.0
glance-k137-worker2   NotReady   <none>   5m38s   v1.37.0
kubectl describe node glance-k137-worker2
Taints:             node.kubernetes.io/unreachable:NoExecute
                    glance-blog/reserved=k23:NoSchedule
                    node.kubernetes.io/unreachable:NoSchedule
...
Conditions:
  Type             Status    LastHeartbeatTime                 LastTransitionTime                Reason              Message
  ----             ------    -----------------                 ------------------                ------              -------
  MemoryPressure   Unknown   Wed, 30 Sep 2026 08:38:46 +0100   Wed, 30 Sep 2026 08:44:04 +0100   NodeStatusUnknown   Kubelet stopped posting node status.
  DiskPressure     Unknown   Wed, 30 Sep 2026 08:38:46 +0100   Wed, 30 Sep 2026 08:44:04 +0100   NodeStatusUnknown   Kubelet stopped posting node status.
  PIDPressure      Unknown   Wed, 30 Sep 2026 08:38:46 +0100   Wed, 30 Sep 2026 08:44:04 +0100   NodeStatusUnknown   Kubelet stopped posting node status.
  Ready            Unknown   Wed, 30 Sep 2026 08:38:46 +0100   Wed, 30 Sep 2026 08:44:04 +0100   NodeStatusUnknown   Kubelet stopped posting node status.

The kubelet stopped at 07:43:14 UTC and the node controller marked it NotReady at 07:44:04, exactly 50 seconds later. The containers on the node kept running, because the runtime does not need the kubelet for that, but every Pod on it was flipped to Ready=False at the same second, which takes it out of Service endpoints:

kubectl -n kube-system get pod kube-proxy-glhq6 -o jsonpath='{range .status.conditions[*]}{.type}={.status} {.lastTransitionTime}{"\n"}{end}{range .status.containerStatuses[*]}{.name} ready={.ready}{"\n"}{end}'
PodReadyToStartContainers=True 2026-09-30T07:38:36Z
Initialized=True 2026-09-30T07:38:35Z
Ready=False 2026-09-30T07:44:04Z
ContainersReady=True 2026-09-30T07:38:36Z
PodScheduled=True 2026-09-30T07:38:34Z
kube-proxy ready=true

The container is still ready by its last report; the Pod is not, because nobody is left to vouch for it.

A brand-new node is worse off. The flag is rejected before the kubelet has read its config or contacted the API server, so a new node with the flag never registers and never appears in kubectl get nodes at all.

Why it happens

The kubelet disables Cobra’s flag parsing and parses its own command line as the first thing its command does. On release-1.37, cmd/kubelet/app/server.go line 184 calls cleanFlagSet.Parse(args), and line 185 wraps any error as failed to parse kubelet flag. Config file loading, cAdvisor, node registration and the heartbeat all come later, so an unknown flag stops the process with nothing else to report.

The flag is rejected before the kubelet has done anything the API server could see. The node only goes NotReady because the heartbeats stop.

The rest is ordinary node-failure handling. The node controller’s node-monitor-grace-period defaults to 50 seconds (pkg/controller/nodelifecycle/config/v1alpha1/defaults.go line 46 on release-1.37). After that it writes Kubelet stopped posting node status. (node_lifecycle_controller.go line 1023), marks the node’s Pods not ready and adds the node.kubernetes.io/unreachable taints. Pods that carry the default 300-second toleration for that taint, added by the DefaultTolerationSeconds admission plugin, are evicted after that; DaemonSet Pods tolerate it and stay.

These flags were never meant to be kubelet flags. cAdvisor registers its options on Go’s global flag set, and the kubelet used to copy some of them onto its own command line. #57613, merged for 1.10 in January 2018, registered them as deprecated with the message “This is a cadvisor flag that was mistakenly registered with the Kubelet”. Seventeen of today’s eighteen come from that list (the Docker ones in it left with dockershim); --containerd-namespace was added, already deprecated, in 1.20 by #87054. On release-1.36 the list is cmd/kubelet/app/options/globalflags_linux.go lines 46 to 65. Deprecated flags in pflag keep working and print a warning, which is what 1.36 does:

kubelet --containerd=/run/containerd/containerd.sock --version
Kubernetes v1.36.1
Flag --containerd has been deprecated, This is a cadvisor flag that was mistakenly registered with the Kubelet. Due to legacy concerns, it will follow the standard CLI deprecation timeline before being removed.

On 1.37.0 the same command fails the same way the service does:

E0930 07:43:07.898871     729 run.go:72] "command failed" err="failed to parse kubelet flag: unknown flag: --containerd"

#139870, merged on 25 June 2026, moved the kubelet to cadvisor/lib and re-registers only --housekeeping-interval (line 40 of the same file on release-1.37). kubelet --help on 1.36.1 lists all eighteen with (DEPRECATED: ...); on 1.37.0 none of them.

The warning was easy to miss for eight years, and so is the removal. In the 1.37 CHANGELOG it is filed under Dependency, not under Urgent Upgrade Notes, and the v1.37 release announcement does not mention it.

The eighteen flags are --application-metrics-count-limit, --boot-id-file, --container-hints, --containerd, --containerd-namespace, --enable-load-reader, --event-storage-age-limit, --event-storage-event-limit, --global-housekeeping-interval, --log-cadvisor-usage, --machine-id-file, and the seven --storage-driver-* flags (-user, -password, -host, -db, -table, -secure, -buffer-duration). The underscore spellings that pflag used to normalise, such as --storage_driver_host, are rejected too.

The fastest check, before you upgrade

/configz will not help: these were only ever command-line flags, never KubeletConfiguration fields. Look at the process and at the files that build its command line. This script checks both, and runs from a node debug pod, so you do not need SSH:

RE='--(application[-_]metrics|boot[-_]id|container[-_]hints|containerd|enable[-_]load|event[-_]storage|global[-_]housekeeping|log[-_]cadvisor|machine[-_]id|storage[-_]driver)[^ "]*'
echo "running kubelet:"
tr '\0' '\n' < /proc/$(pidof kubelet)/cmdline | grep -Eo -e "^$RE"
echo "kubelet config files:"
cd /host && grep -rsEo -e "$RE" etc/systemd/system/kubelet.service.d etc/default/kubelet etc/sysconfig/kubelet var/lib/kubelet/kubeadm-flags.env
true

Save it as check.sh, then:

kubectl debug node/<node> --image=busybox:1.36 --profile=sysadmin -- sh -c "$(cat check.sh)"
kubectl logs node-debugger-<node>-<suffix>
running kubelet:
kubelet config files:
etc/default/kubelet:--containerd=/run/containerd/containerd.sock

That is the dangerous state, on a 1.37.0 node where I had written the flag into /etc/default/kubelet without restarting: the running kubelet looks clean and the next restart will fail. On a clean node both sections are empty. A node debug pod runs in the host’s namespaces with the node’s filesystem at /host; sysadmin makes it privileged. I run it detached and read the logs because with -i the script often finished before kubectl attached, and printed nothing. The file list covers kubeadm-style installs; systemctl cat kubelet on one node shows which EnvironmentFile lines yours actually reads. Delete the finished node-debugger-* pods afterwards.

On 1.36 nodes the kubelet also confesses at every start: the Flag --... has been deprecated line above goes to stderr, which systemd sends to the journal, so journalctl -u kubelet | grep 'has been deprecated' finds any node that sets one.

Where the flag comes from depends on who built the node:

  • kubeadm: nodeRegistration.kubeletExtraArgs ends up in /var/lib/kubelet/kubeadm-flags.env. Hand-added flags go in KUBELET_EXTRA_ARGS, which the packaged 10-kubeadm.conf reads from /etc/sysconfig/kubelet; kind’s reads /etc/default/kubelet.
  • EKS on AL2023: extra flags are the spec.kubelet.flags list of the NodeConfig in your launch template’s user data (nodeadm/api/v1alpha1/nodeconfig_types.go line 70 in amazon-eks-ami). A new node built from a template carrying one of these flags will not join.
  • MicroK8s sets --containerd=${SNAP_COMMON}/run/containerd.sock in its default kubelet args on master as of 30 September 2026. There is no MicroK8s 1.37 release yet; a work-in-progress branch removes the line and adds a snap hook to strip it from existing nodes.
  • k3s and k0s passed --containerd too, and both work around the removal themselves (details below): k3s from v1.37.0+k3s1, k0s on its main branch, with no k0s 1.37 release yet. Upgrade through the distribution rather than swapping the kubelet binary.

Fixing a node that will not start

Delete the flag from wherever it lives, then systemctl daemon-reload if you edited a unit file, and restart the kubelet. With the original /etc/default/kubelet restored, the same node was Ready again five seconds after the restart.

Check the whole command line, not just the flag in the error. pflag stops at the first unknown flag, so a node with two of them fails twice:

kubelet --machine-id-file=/etc/machine-id --containerd=/run/containerd/containerd.sock --version
E0930 07:45:58.340201    3366 run.go:72] "command failed" err="failed to parse kubelet flag: unknown flag: --machine-id-file"

Most of the eighteen configured parts of cAdvisor the kubelet never used, such as the standalone binary’s storage drivers and event store, and removing them changes nothing. A few did something:

  • --machine-id-file and --boot-id-file chose where cAdvisor reads the IDs the kubelet reports as status.nodeInfo.machineID and bootID. Without them it reads /etc/machine-id,/var/lib/dbus/machine-id and /proc/sys/kernel/random/boot_id (lib/machine/info.go lines 39 and 40 at lib/v0.60.5). If you pointed them elsewhere, make the default files correct instead.
  • --enable-load-reader turned on the data behind three metrics, and those metrics are gone with it.
  • --containerd and --containerd-namespace told cAdvisor how to reach containerd. This is the one that can break your dashboards; it has its own section below.

What disappeared from /metrics/cadvisor

Run on a 1.36.1 node and a 1.37.0 node:

kubectl get --raw /api/v1/nodes/<node>/proxy/metrics/cadvisor \
  | grep -oE '^container_(tasks_state|cpu_load_average_10s|cpu_load_d_average_10s)\{' | sort | uniq -c
 142 container_cpu_load_average_10s{
 142 container_cpu_load_d_average_10s{
 710 container_tasks_state{

On 1.37.0 the same command prints nothing. Collecting the metric names for a CPU-limited, single-container Pod on each version and diffing them shows exactly those three gone, and nine families that are new:

kubectl get --raw /api/v1/nodes/<node>/proxy/metrics/cadvisor | grep 'pod="<pod>"' | sed 's/{.*//' | sort -u > families-1.37.txt
diff families-1.36.txt families-1.37.txt
7,8d6
< container_cpu_load_average_10s
< container_cpu_load_d_average_10s
11a10
> container_creation_time_seconds
19a19,20
> container_memory_events_high_total
> container_memory_events_max_total
21a23,24
> container_memory_file_dirty_bytes
> container_memory_file_writeback_bytes
24a28,29
> container_memory_pgscan_total
> container_memory_pgsteal_total
30a36,37
> container_memory_workingset_refault_anon_total
> container_memory_workingset_refault_file_total
49d55
< container_tasks_state

The additions come from cadvisor/lib (none of them exist in cAdvisor v0.56.2, which 1.36 used) and are not in the 1.37 CHANGELOG. Throttling, usage and memory series are unchanged.

Before rewriting any dashboards, look at the values you were getting:

kubectl get --raw /api/v1/nodes/<node>/proxy/metrics/cadvisor \
  | grep -E '^container_(tasks_state|cpu_load_average_10s|cpu_load_d_average_10s)\{' | awk '$2 != 0' | wc -l
       0

Not one of the 994 series on that 1.36 node was non-zero, and that is by design. All three are filled in by cAdvisor’s netlink load reader, which only runs when --enable-load-reader is set and defaults to off (manager/container.go lines 51 and 475 in cAdvisor v0.56.2). On a stock kubelet they were exported as zeros. On 1.36 the kubelet asked for them by including CpuLoadMetrics in its metric set (pkg/kubelet/server/server.go line 507 on release-1.36); on 1.37 that entry is gone (lines 516 to 525).

So for most clusters a panel on these series changes from a flat zero to No data. The people who had real numbers are exactly the ones who set --enable-load-reader, which is also one of the flags that now stops the kubelet.

The custom application metrics went the same way. cAdvisor collected them from containers labelled io.cadvisor.metric.<name> pointing at a collector config; the kubelet surfaced them as userDefinedMetrics in /stats/summary and as extra families in /metrics/cadvisor. In cadvisor/lib the collector hook is left nil for the kubelet (lib/manager/plugins.go line 64 at lib/v0.60.5), so nothing is ever collected. Neither of my clusters had a container using it:

kubectl get --raw /api/v1/nodes/<node>/proxy/stats/summary | jq '[.pods[].containers[] | select(.userDefinedMetrics)] | length'
0

Finding the queries that depend on them

Ask Prometheus which nodes still send them. Against a Prometheus 3.14 scraping /metrics/cadvisor on one 1.36.1 node and one 1.37.0 node:

curl -sG "$PROM/api/v1/query" --data-urlencode 'query=count by (node, __name__) ({__name__=~"container_(tasks_state|cpu_load_average_10s|cpu_load_d_average_10s)"})' \
  | jq -r '.data.result[] | "\(.metric.node)  \(.metric.__name__)  \(.value[1])"'
glance-blog-control-plane  container_cpu_load_average_10s  153
glance-blog-control-plane  container_cpu_load_d_average_10s  153
glance-blog-control-plane  container_tasks_state  765

The 1.37 node is simply absent. Use whichever label your scrape config puts the node name in. If Prometheus is not exposed, you can run the same query through the API server’s service proxy; see query Prometheus through the Kubernetes API server.

Then grep what you own: exported dashboard JSON, PrometheusRule objects, recording rules, and anything that alerts on absent(). Of the stacks I checked, none depends on these series. The kubernetes-mixin dashboards and rules do not reference them. kube-prometheus goes further and drops container_tasks_state and container_cpu_load_average_10s at scrape time (kubernetesControlPlane-serviceMonitorKubelet.yaml line 63). kube-prometheus-stack carries the same drop rule only as a commented example under kubelet.serviceMonitor.cAdvisorMetricRelabelings. Of the eighteen widely used Kubernetes and cAdvisor dashboards I downloaded from grafana.com, one queries them: cadvisor dashboard (19792).

The one flag that was doing something: –containerd

The kubelet’s embedded cAdvisor talks to containerd directly, not through the CRI, to learn which Pod and container each cgroup belongs to. That is where the container, pod, namespace and image labels on /metrics/cadvisor come from. In cadvisor/lib the socket path is a flag variable that defaults to /run/containerd/containerd.sock (lib/container/containerd/factory.go line 36). On 1.36 --containerd set it. On 1.37 nothing does: the kubelet does not pass its own containerRuntimeEndpoint across.

On a containerd node, kubectl top and Prometheus read different halves of the kubelet. Only the cAdvisor half depends on the socket path, and in 1.37 that path can no longer be set.

To see what that means, I moved the containerd socket on a 1.37.0 node to /run/k23/containerd.sock, pointed containerRuntimeEndpoint at it and restarted the kubelet. The node stayed Ready. The kubelet logged, at info level:

I0930 07:57:28.484677    5445 factory.go:220] Registration of the containerd container factory failed: unable to create containerd client: containerd: cannot unix dial containerd api service: dial unix /run/containerd/containerd.sock: connect: no such file or directory

and every container’s series lost its identity. Counting the series for a Pod whose only container is called app:

kubectl get --raw /api/v1/nodes/<node>/proxy/metrics/cadvisor | grep -c 'container="app"'

Before the move this printed 54; after it, 0. The same container’s memory now looks like this:

container_memory_working_set_bytes{container="",id="/kubelet.slice/kubelet-kubepods.slice/kubelet-kubepods-burstable.slice/kubelet-kubepods-burstable-pod935e4025_f028_4e90_83f0_c190f72fb21d.slice/cri-containerd-ffe8d1fd7df3802c6a4cae67100d85ca2bd4e303779efcbe74c29556fbc2dfd3.scope",image="",name="",namespace="",pod=""} 278528 1790755086667

Any query with container!="", which is how the kubernetes-mixin resource dashboards filter out cgroup totals, finds nothing from that node once the old series have gone stale. Meanwhile /metrics/resource and /stats/summary still named the Pod correctly, because on containerd nodes they come from the CRI stats provider through containerRuntimeEndpoint:

container_memory_working_set_bytes{container="app",namespace="k23-cadvisor",pod="limited"} 278528 1790755109302

So metrics-server, kubectl top and the HPA carry on, while every Prometheus panel built on cAdvisor goes blank. If you have met the two paths disagreeing before, this is the same split as in why kubectl top disagrees with your dashboard, taken to its extreme.

If --containerd pointed at the default path, deleting it costs nothing. If it pointed anywhere else, make the socket reachable at the default path as well. A symlink is enough; with /run/containerd/containerd.sock -> /run/k23/containerd.sock in place and the same kubelet restarted, the log said Registration of the containerd container factory successfully and the count was back to 54. /run is a tmpfs, so create the link at boot with a tmpfiles.d entry:

printf "L /run/containerd/containerd.sock - - - - /run/k23/containerd.sock\n" > /etc/tmpfiles.d/containerd-default-sock.conf
systemd-tmpfiles --create /etc/tmpfiles.d/containerd-default-sock.conf
ls -la /run/containerd/containerd.sock
lrwxrwxrwx 1 root root 24 Sep 30 08:00 /run/containerd/containerd.sock -> /run/k23/containerd.sock

The distributions with their own socket paths each patched around this rather than live with it. k3s sets cAdvisor’s endpoint from its own runtime socket now that the flag is gone. k0s builds its kubelet with a patch that registers --containerd and --containerd-namespace again. --containerd-namespace had the same role for the containerd namespace, which defaults to k8s.io.

The longer-term fix upstream is to stop needing cAdvisor for container stats at all. That is KEP-2371, the PodAndContainerStatsFromCRI feature gate, which went to beta in 1.37 but is still off by default. I did not test it here.

Preventing it

  • Run the node check on every node pool before the 1.37 upgrade. Nodes built from the same template or user data share their flags, so one node per pool is usually enough; check any node that was ever hand-edited separately.
  • On 1.36, treat has been deprecated in the kubelet journal as a blocker. Apart from kubelet --help, it is the only warning these flags ever gave.
  • Upgrade one node first and look at its metrics, not just its status. A node can be Ready with anonymous cAdvisor series. count by (node) (container_memory_working_set_bytes{container!=""}) should still return a figure for the upgraded node, close to that of a neighbour running similar Pods.
  • Read the Dependency section of the CHANGELOG as well as the upgrade notes. That is where this one was.

Before draining nodes for the upgrade, it is worth checking the rest of what a node restart costs: can your cluster lose a node?

A node that fails its upgrade shows up as NotReady, with its conditions, once the heartbeats stop. KubeGlance is a native Kubernetes client for iPhone and iPad, with a full Mac app on the same core: node status, conditions and kubelet versions for every node, straight from your kubeconfig.

Get KubeGlance
#kubelet #cadvisor #upgrade #metrics #prometheus

The Kubernetes dashboard that fits in your pocket

KubeGlance is a native Kubernetes client for iPhone and iPad — the real dashboard, not a companion — with a full Mac app on the same core. Pods, workloads, logs and events, straight from your kubeconfig.

Download KubeGlance