Containers

Kubernetes 1.38: What’s New, Removals and Upgrade Notes

Kubernetes 1.38 ships on 16 December 2026, and the change most likely to hurt you isn’t a new feature. It’s the 20 feature gates that are gone for good. Leave one of them in a --feature-gates flag or a kubelet config and the component will not start. A kubeadm upgrade then waits nearly seven minutes for an API server that never answers and rolls back. The release also adds DynamicContainers, which lets you add a container to a running pod, and renames metrics your alerts may use.

Original content from computingforgeeks.com - post 205625

We built three kubeadm nodes on Google Cloud (two on Ubuntu 26.04, one on 24.04) on 1.37 with deliberately bad settings, then upgraded them. Every command and error below was captured on that cluster in December 2026. For the upgrade procedure itself, follow our step-by-step kubeadm cluster upgrade guide; this page tells you what to fix before you run it.

Check what changed in Kubernetes 1.38

Most of the release is safe to take as is. The rows that matter for an upgrade are the ones in the last column, because each of them broke something or changed something visible in our lab:

AreaChange in 1.38What you’ll notice
Feature gates20 gates removed, most of them GA and locked, among them NodeSwap, RelaxedEnvironmentVariableValidation, SupplementalGroupsPolicy and ExecProbeTimeoutkube-apiserver exits with unrecognized feature gate, the kubelet panics
PodsDynamicContainers alpha: add and remove containers through pods/dynamicNeeds a gate on the API server and the kubelet, plus RBAC no default role grants
Env filesKEY='value'#suffix is now a parse errorContainer fails with couldn't parse env file
Webhook metrics_count metrics deprecated, rejection_total and fail_open_total added, request_total promoted to betaBoth names emitted for now, alerts should move
Scheduler metricstype label renamed to entity on the queue metricsQueries filtering on type="pod" return nothing
kubectlNo /openapi/v2 download, websocket opt-out variables removedValidation uses OpenAPI v3 only, SPDY can’t be forced
Runtimecontainerd 1.x flagged for loss of supportJoin works with a warning, kubelet falls back to its own cgroup driver setting
kubeadmetcd 3.7.3 default, etcd in upgrade diff, rollback fix, ML-DSAA failed etcd upgrade now restores to the right directory

Two things in that table are easy to misread. IPVS mode in kube-proxy is not removed in this release: it was deprecated in 1.35 and the project’s IPVS removal announcement plans the removal for 1.40, so you have time to move to nftables. And EnvFiles itself is still beta, enabled by default, because its promotion to GA was reverted late in the cycle. The full list lives in the 1.38 changelog.

Remove dead feature gates before the upgrade

A feature gate that reaches GA is locked on for a few releases, and during that time setting it only logs a warning. On our 1.37 worker, the kubelet with NodeSwap: true in its config printed Warning: setting GA feature gate. It will be removed in a future release. and carried on. In 1.38 the gate no longer exists, so the same setting is a fatal error. These are the 20 gates removed in this release. Most were GA and locked, while PodGroupPreemptionPolicy was an alpha gate and AggregatedDiscoveryRemoveBetaType, AllowOverwriteTerminationGracePeriodSeconds and WindowsHostNetwork were deprecated, but all of them fail the same way:

  • NodeSwap, SystemdWatchdog, ExecProbeTimeout
  • RelaxedEnvironmentVariableValidation, SupplementalGroupsPolicy
  • PodSchedulingReadiness, SeparateTaintEvictionController
  • AllowOverwriteTerminationGracePeriodSeconds, MatchLabelKeysInPodAffinity
  • RecoverVolumeExpansionFailure, PodGroupPreemptionPolicy
  • CustomResourceFieldSelectors, CRDValidationRatcheting
  • DynamicResourceAllocation, AggregatedDiscoveryRemoveBetaType
  • KubeletTracing, ServiceAccountTokenPodNodeInfo
  • WinDSR, WinOverlay, WindowsHostNetwork (Windows nodes)

The deprecated metrics.k8s.io/v1alpha1 types are gone from the code too, so any client still built against them should move to v1 or v1beta1. To see whether your cluster carries any of the removed gates, check every place kubeadm can keep them: the static pod manifests, the kubeadm-config ConfigMap, the kubelet-config and kube-proxy ConfigMaps, and each node’s own kubelet files. On RPM distributions the kubelet defaults file is /etc/sysconfig/kubelet rather than /etc/default/kubelet.

sudo grep -rn feature-gates /etc/kubernetes/manifests/
kubectl -n kube-system get cm kubeadm-config -o jsonpath='{.data.ClusterConfiguration}' | grep -A3 extraArgs
kubectl -n kube-system get cm kubelet-config -o yaml | grep -A5 featureGates
kubectl -n kube-system get cm kube-proxy -o yaml | grep -A5 featureGates
sudo grep -A5 featureGates /var/lib/kubelet/config.yaml
sudo cat /var/lib/kubelet/kubeadm-flags.env /etc/default/kubelet /etc/sysconfig/kubelet 2>/dev/null

Our control plane had been built with the API server gate in the kubeadm config on purpose, and the ConfigMap check found it:

  extraArgs:
  - name: feature-gates
    value: RelaxedEnvironmentVariableValidation=true

kubeadm’s preflight checks don’t look at gate names, so kubeadm upgrade apply started normally with that value in place. It upgraded etcd, wrote the new kube-apiserver manifest and then waited for an API server that kept exiting. After 6 minutes 40 seconds it gave up with a connection refused error and restored the 1.37 manifests. The upgrade error says nothing about feature gates, which is why we ran the new API server image directly to get the real reason:

kubeadm upgrade apply to Kubernetes 1.38 failing because kube-apiserver rejects the removed RelaxedEnvironmentVariableValidation feature gate

The rollback put the 1.37 manifests back from the backup directory and the old API server came back up. To fix it, you edit the ConfigMap and delete the gate entry. If it was the only extra argument, leave apiServer: {} behind so the YAML stays valid:

kubectl -n kube-system edit cm kubeadm-config

With the gate gone, the same kubeadm upgrade apply finished in 2 minutes 14 seconds and ended on the line you want to see:

[upgrade] SUCCESS! A control plane node of your cluster was upgraded to "v1.38.0-rc.0".

A kubelet fails louder. Our worker still had NodeSwap: true under featureGates in /var/lib/kubelet/config.yaml, and the moment the 1.38 package was installed, systemd restarted the kubelet straight into a panic:

Kubernetes 1.38 kubelet panic with unrecognized feature gate NodeSwap in journalctl

On this node it healed three seconds later, because kubeadm upgrade node rewrote /var/lib/kubelet/config.yaml from the kubelet-config ConfigMap and the locally added gate disappeared with it. Don’t count on that. If your gate sits in the kubelet-config ConfigMap, every node gets it back on each upgrade, and if it is in /etc/default/kubelet or a systemd drop-in, kubeadm never touches it. Clean all of them on 1.37, while a warning is the only cost.

Add containers to running pods with DynamicContainers

DynamicContainers is the headline alpha feature. Until now, a pod’s list of regular containers was fixed at creation, and the only way to attach something to a running pod was an ephemeral debug container with no resources and no restart. In 1.38 you can add a real container, with requests, to a running pod, and remove it again, through a new pods/dynamic subresource. It’s alpha and off by default, so this belongs on a test cluster, not a production one.

You need the gate on in two places, because the API server validates the change and the kubelet on the pod’s node has to apply it. On the control plane, add the flag to the static pod manifest; the kubelet restarts the API server when the file changes:

sudo vim /etc/kubernetes/manifests/kube-apiserver.yaml

Add the gate as the first argument under the kube-apiserver command:

    - kube-apiserver
    - --feature-gates=DynamicContainers=true

On each worker that should accept dynamic containers, append the gate to the kubelet config and restart the kubelet. A later kubeadm upgrade overwrites both files, so for anything that has to survive upgrades, put the gate in the kubeadm-config and kubelet-config ConfigMaps instead. The append below only works on a config with no featureGates: block yet. Ours had none, because the upgrade had dropped NodeSwap. If you already have one, add the line under it instead of creating a second key:

printf "featureGates:\n  DynamicContainers: true\n" | sudo tee -a /var/lib/kubelet/config.yaml
sudo systemctl restart kubelet

To confirm the gate took, read the API server’s own metrics. A 1 means it is on:

kubectl get --raw /metrics | grep 'name="DynamicContainers"'

Our control plane reported it as an enabled alpha feature:

kubernetes_feature_enabled{name="DynamicContainers",stage="ALPHA"} 1

For the test we used a namespace, a pod with CPU and memory requests (so its QoS class is Burstable), and a service account bound to the built-in edit role, which is what most developer access looks like. Save it as dyn-demo.yaml:

apiVersion: v1
kind: Namespace
metadata:
  name: dyn-demo
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: dev
  namespace: dyn-demo
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: dev-edit
  namespace: dyn-demo
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: edit
subjects:
- kind: ServiceAccount
  name: dev
  namespace: dyn-demo
---
apiVersion: v1
kind: Pod
metadata:
  name: web
  namespace: dyn-demo
spec:
  containers:
  - name: app
    image: busybox:1.37
    command: ["sh", "-c", "tail -f /dev/null"]
    resources:
      requests:
        cpu: 100m
        memory: 64Mi

Put the container you want to add in a patch file, add-helper.yaml. It carries its own requests, which the kubelet treats as a resize of the pod:

spec:
  containers:
  - name: helper
    image: busybox:1.37
    command: ["sh", "-c", "tail -f /dev/null"]
    resources:
      requests:
        cpu: 50m
        memory: 32Mi

No default role grants access to the new subresource. The admin, edit and view ClusterRoles in our cluster contained no pods/dynamic rule at all, so you need a Role like this one in pods-dynamic-role.yaml:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: pod-dynamic-editor
  namespace: dyn-demo
rules:
- apiGroups: [""]
  resources: ["pods/dynamic"]
  verbs: ["get", "patch", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: dev-pod-dynamic
  namespace: dyn-demo
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: pod-dynamic-editor
subjects:
- kind: ServiceAccount
  name: dev
  namespace: dyn-demo

Run the patch three ways and you see the whole model. A normal patch is refused as before, the service account with only edit is denied on pods/dynamic, and once the Role is applied the same patch succeeds and the pod goes to 2/2:

Kubernetes 1.38 DynamicContainers adding a container to a running pod through the pods/dynamic subresource after granting RBAC

The pod kept its QoS class (Burstable) and the events show how the kubelet handled it: a ResizeCompleted event listing both containers with their requests. Right after the patch, the new container sat in ContainerCreating for a few seconds while the app container kept running. Removing it uses a strategic merge delete directive on the same subresource:

kubectl -n dyn-demo patch pod web --subresource dynamic --patch '{"spec":{"containers":[{"name":"helper","$patch":"delete"}]}}'

Three things caught us while testing it, and none of them is in the changelog:

  • kubectl auth can-i patch pods/dynamic answered yes for the edit-only account, which is wrong. kubectl reads the slash as a resource name. The right check is kubectl auth can-i patch pods --subresource=dynamic, which said no.
  • A removed container gets SIGTERM, then SIGKILL after the grace period. Our tail ignored SIGTERM, so it took 30 seconds and ended with exit code 137.
  • The terminated status stays on the pod, and you cannot reuse the name: re-adding helper failed with a status for container "helper" is still present.

We then turned the gate off on the worker only, to see what a mixed cluster does. The API server refused the patch outright with pod update requires features DynamicContainers which are not available on node, because the kubelet advertises its features in the node status and the API server checks them before accepting the change. That’s the right failure: nothing half-applied. The feature is Linux only, works on regular containers only, takes CPU and memory requests but not privileged containers or host ports, and cannot change a pod’s QoS class. The KEP also rules out pods that use swap and pods that haven’t finished their init containers.

Review the other new features

Not everything else is opt in. PodLevelResources goes GA in this release, and on nodes running LimitedSwap the kubelet now writes pod-level and container-level memory.swap.max limits for pods that set pod-level resources, so swap use on those pods can change after the upgrade. Several beta features such as ContainerStopSignals and EmptyDirVolumeMode are also on by default now. The new features below are a different story: they’re alpha, so you opt in per cluster. We read each gate’s default from the 1.38 API server’s own --help output, and every one of these four reported ALPHA - default=false:

  • ConditionalAuthorization: conditional authorization in kube-apiserver (KEP-5681)
  • SecurityProfileOCI: seccompProfile.type: OCI with a digest-pinned oci.ref, pulled through the runtime
  • DynamicNodeLocalEphemeralVolumes: add emptyDir, configMap, secret, projected and image volumes through /dynamic
  • DynamicContainers: covered above

Dynamic volumes only make sense together with DynamicContainers, because in this first alpha you cannot change the volumeMounts of a container that already exists. The new volume is used by a container you add in the same way. OCI seccomp profiles are the one we’d watch, since shipping a profile as a registry artifact with a digest removes the need to copy JSON files onto every node. One API server change needs care on rollback: mutating webhook admission configuration gains a staticOrder field, and 1.37 refuses to start with it, so remove it before you downgrade. It only applies to clusters that load manifest-based webhooks through staticManifestsDir with the ManifestBasedAdmissionControlConfig gate, so most kubeadm clusters never see it.

Fix env files that stop parsing

EnvFiles reads variables from a file that an init container writes, through fileKeyRef. In 1.37 the parser accepted a line with text glued to the closing quote and quietly dropped the tail. In 1.38 that line is an error, and the release notes warn that affected containers may fail to start. Our test pod wrote GREETING='hello'#prod, which is a comment attached to the value with no space:

apiVersion: v1
kind: Pod
metadata:
  name: envfile-demo
spec:
  restartPolicy: Never
  initContainers:
  - name: write-env
    image: busybox:1.37
    command: ["sh", "-c", "echo \"GREETING='hello'#prod\" > /config/app.env"]
    volumeMounts:
    - name: config
      mountPath: /config
  containers:
  - name: app
    image: busybox:1.37
    command: ["sh", "-c", "echo GREETING=$GREETING"]
    env:
    - name: GREETING
      valueFrom:
        fileKeyRef:
          path: app.env
          volumeName: config
          key: GREETING
  volumes:
  - name: config
    emptyDir: {}

On 1.37 this pod completed and printed GREETING=hello. The same manifest on a 1.38 node never started the app container. The pod event only says the file couldn’t be parsed; the kubelet journal on the node has the line number and the reason:

Kubernetes 1.38 kubelet rejecting an env file with unexpected content after closing quote

Watch the pod status while that happens, because you might misread it: it sits at PodInitializing rather than going to an error state, so a deployment can look stuck instead of broken. A space before the # turns the suffix back into a comment. With GREETING='hello' #prod the pod completed on 1.38 and printed GREETING=hello. Search whatever generates your env files for a quote followed directly by #. A space between = and the opening quote (KEY= 'value') is also a parse error now.

Update dashboards for renamed metrics

Two sets of metrics change names, and only one of them gives you overlap. For admission webhooks, 1.38 adds apiserver_admission_webhook_rejection_total and apiserver_admission_webhook_fail_open_total, and marks the old _count metrics deprecated. We pointed one validating webhook at a missing service with failurePolicy: Ignore and another with Fail, created one object against each, and read the metrics:

Kubernetes 1.38 apiserver metrics showing deprecated admission webhook _count metrics next to the new rejection_total and fail_open_total

Both names carry the same value and labels, so switching your alert is a rename and nothing else. The deprecated pair will be hidden in a later release. An alert on a metric that no longer exists does not fire, so change yours now while you can compare old and new side by side. apiserver_admission_webhook_request_total is now beta as well.

The scheduler change has no overlap. Both scheduler_queued_entities and scheduler_queue_incoming_entities_total renamed their type label to entity. We kept one pod Pending with an impossible node selector and read the scheduler’s metrics on port 10259 before and after. On 1.37:

scheduler_queue_incoming_entities_total{event="UnscheduledPodAdd",queue="active",type="pod"} 9
scheduler_queued_entities{queue="unschedulable",type="pod"} 1

On 1.38, the same pending pod showed up under the new label, and scheduler_queued_entities also gained an operation label:

scheduler_queue_incoming_entities_total{entity="pod",event="UnscheduledPodAdd",queue="active"} 5
scheduler_queued_entities{entity="pod",operation="initial_placement",queue="unschedulable"} 1

A PromQL query with {type="pod"} returns an empty result after the upgrade rather than an error, which is the worst kind of break for a dashboard. Both metrics are alpha, so this is allowed by the deprecation policy, but grep your recording rules for them before the control plane moves.

Expect a different kubectl

kubectl 1.38 stops downloading /openapi/v2 for client-side validation. With the cache cleared, applying a List of ConfigMaps at -v=6 on 1.37 fetched the v2 document; the 1.38 client only asked for v3:

round_trippers.go:632] "Response" verb="GET" url="https://10.142.0.46:6443/openapi/v3?timeout=32s" status="200 OK" milliseconds=8

Against any API server from the last several years, you won’t see a difference. It matters if you run an aggregated API server or a proxy that only serves v2, because validation now depends on v3. The plaintext-openapiv2 output of kubectl explain is deprecated for the same reason.

The websocket opt-out is gone too. On 1.37, KUBECTL_REMOTE_COMMAND_WEBSOCKETS=false made kubectl exec fall back to SPDY, and the request showed Upgrade: SPDY/3.1. On 1.38 the variable is ignored and both exec and port-forward used websockets:

KUBECTL_REMOTE_COMMAND_WEBSOCKETS=false kubectl exec ws-demo -v=8 -- true 2>&1 | grep Upgrade:

You’ll see the websocket header even with the variable set:

	Upgrade: websocket

If you set that variable to get through a load balancer or bastion that breaks websockets, fix the proxy before you hand out the new kubectl. Elsewhere in kubectl, kuberc is now GA, kubectl drain and uncordon write DrainInProgress and Drained node conditions, and Kustomize no longer loads .so plugins. Our kubectl cheat sheet has the everyday commands that didn’t change.

Plan the move off containerd 1.x

Kubernetes 1.35 announced that it was the last to support containerd 1.x, and a lot of upgrade notes now say a containerd 1.7 node can’t join a 1.38 cluster. We tested that rather than repeat it. Our third node ran Ubuntu 24.04 with the containerd package from the noble release pocket, which is 1.7.12, and joined with the 1.38 kubeadm. Preflight printed a warning, not an error:

E1206 12:49:33.252938    3591 remote_runtime.go:1380] "RuntimeConfig from runtime service failed" err="rpc error: code = Unimplemented desc = unknown method RuntimeConfig for service runtime.v1.RuntimeService"
	[WARNING ContainerRuntimeVersion]: You must update your container runtime to a version that supports the CRI method RuntimeConfig. Falling back to using cgroupDriver from kubelet config will be removed in 1.38. For more information, see https://git.k8s.io/enhancements/keps/sig-node/4033-group-driver-detection-over-cri

The node joined, went Ready and ran a pod. The kubelet logged that it was falling back to the cgroupDriver in its own config, and it set the kubelet_cri_losing_support metric to warn that this runtime loses support with 1.38:

Kubernetes 1.38 node running containerd 1.7.12 with kubelet_cri_losing_support metric set

So the hard failure did not happen in our build, but every signal says it’s next. The warning text names 1.38 as the removal point and the 1.38 sneak peek describes the kubelet requiring the RuntimeConfig call. That change, the pull request that turns off the cgroupDriver fallback by default, had not merged when we tested, which is why our join still worked. If it lands, the same join becomes a preflight error, so treat containerd 1.x on a 1.38 node as unsupported even where it works. Scrape kubelet_cri_losing_support across your fleet and you’ll find the stragglers. On Ubuntu 24.04 the fix is cheap, because noble-updates already carries containerd 2.2.1, which is what our other nodes ran (2.2.2 on Ubuntu 26.04). Fresh installs from our kubeadm guide for Ubuntu 26.04 or the Rocky Linux and AlmaLinux kubeadm setup already get containerd 2.

Use the kubeadm 1.38 changes

kubeadm got small, practical fixes this time. The default etcd moves to 3.7.3, and our upgraded control plane ran registry.k8s.io/etcd:3.7.3-0. When you run kubeadm upgrade diff or a dry run of upgrade apply and upgrade node, the etcd static pod manifest is now included, so the preview shows the etcd image change too. The rollback fix matters most. After a failed etcd upgrade, kubeadm used to copy the backup into a subdirectory of the member directory instead of restoring it in place. It now restores to the right path, and it retries the pre-upgrade backup for up to 30 seconds.

New clusters on the v1beta4 config can set encryptionAlgorithm to ML-DSA-44, ML-DSA-65 or ML-DSA-87. The kubeadm notes warn that other components may not support it yet, and a default setup with ML-DSA might fail. Leave it on RSA or ECDSA for any cluster you need to keep. kubeadm upgrade plan also returns an error instead of panicking when it can’t work out the latest kube-apiserver version. The order of operations has not changed from earlier releases, and our kubeadm upgrade walkthrough covers it node by node, including the drain and the kubelet restart.

Fix errors seen on a 1.38 cluster

These are the exact messages you’ll get, copied from our lab, with the cause we confirmed for each.

“unrecognized feature gate: RelaxedEnvironmentVariableValidation”

kube-apiserver exits at startup, and kubeadm only reports failed to obtain static Pod hash for component kube-apiserver ... connection refused. Any removed gate name gives the same message. Delete it from the kubeadm-config ConfigMap and from /etc/kubernetes/manifests/, then run the upgrade again.

“panic: failed to merge global and in-flight KubeletConfiguration”

The rest of the line names the gate, unrecognized feature gate: NodeSwap in our case, and systemd records status=2/INVALIDARGUMENT. You fix it by removing the gate from /var/lib/kubelet/config.yaml, the kubelet-config ConfigMap and any kubelet flags, then restart the kubelet.

“unexpected content after closing quote”

It appears in the kubelet journal as invalid environment variable format at line 1, while the pod event only says couldn't parse env file. Put a space between the closing quote and the #, or drop the trailing text.

“cannot get resource “pods/dynamic””

Your caller lacks RBAC on the subresource. kubectl patch reads the subresource before patching it, so the Role needs get as well as patch and update. Check with --subresource=dynamic, not pods/dynamic.

“pod updates may not add or remove containers”

You sent the patch to the pod itself. Add --subresource dynamic. If the error is instead requires features DynamicContainers which are not available on node, the kubelet on the pod’s node doesn’t have the gate.

If you test this on spare hardware rather than cloud VMs, the three-node home cluster build is a good size for rehearsing the upgrade, and every trap above reproduces on it the same way.

Keep reading

Best UI Applications for Managing Docker Containers Containers Best UI Applications for Managing Docker Containers Install Docker and Run Containers on Ubuntu 24.04|22.04 Containers Install Docker and Run Containers on Ubuntu 24.04|22.04 Install UniFi OS Server on Ubuntu 26.04 / 24.04 LTS Containers Install UniFi OS Server on Ubuntu 26.04 / 24.04 LTS Encapsule on Fedora 45: Isolated Dev Containers vs Toolbx Containers Encapsule on Fedora 45: Isolated Dev Containers vs Toolbx Install n8n Nod on Linux: Self-Hosted Personal Agent with Ollama AI Install n8n Nod on Linux: Self-Hosted Personal Agent with Ollama How To Install Snap on Ubuntu or Debian Containers How To Install Snap on Ubuntu or Debian

Leave a Comment

Press ESC to close