Cloud & DevOpsSecurityInfrastructure

Kubernetes v1.37 Garhwal: Lock Down Your Volumes with emptyDir Mode and bindMountOptions

Kubernetes wheel logo with locked padlocks and YAML code illustrating emptyDir and bind mount security hardening in v1.37
Kubernetes v1.37 Garhwal introduces emptyDir permission modes and bindMountOptions for container storage hardening

Kubernetes v1.37 “Garhwal” shipped August 26 with 67 enhancements. DRA graduating to GA grabbed most of the coverage. The story worth your attention is quieter: two alpha features that finally address a class of container storage vulnerability that clusters have been quietly accepting for years — world-writable emptyDir directories and volumes that will happily execute whatever binary gets dropped onto them.

The Security Gap emptyDir Never Fixed

If you have a multi-container pod sharing an emptyDir volume, every container in that pod has read, write, and delete access to every file on it. That is not a configuration mistake — that is the hardcoded default. The permission mode has always been 0777 with no way to change it.

The practical impact: a CI pod with three sidecars building artifacts into a shared emptyDir workspace is one compromised container away from a complete wipe. One container can delete another’s build outputs, overwrite binaries, or inject malicious files. The community flagged this in a GitHub issue back in 2022. v1.37 finally fixes it.

EmptyDir Mode: Set the Sticky Bit

The fix is a new mode field on emptyDir volumes that accepts standard Unix permission bits from 0000 to 01777 (octal). The most useful value is 01777, which applies the sticky bit — files in the directory can only be deleted by their owner or root, regardless of the directory write permissions. This is identical to how /tmp works on every Linux system.

apiVersion: v1
kind: Pod
metadata:
  name: build-workspace
spec:
  containers:
  - name: builder
    image: registry.k8s.io/busybox
    volumeMounts:
    - mountPath: /workspace
      name: shared-workspace
  volumes:
  - name: shared-workspace
    emptyDir:
      mode: 01777

To use it, enable the EmptyDirVolumeMode feature gate on both the API server and the kubelet. If the field is left unset, behavior is unchanged from previous Kubernetes versions. Alpha status means the API may change before it graduates — test clusters first.

The full documentation for this feature is available in the Kubernetes emptyDir volume mode guide.

bindMountOptions: Block Binary Execution on Volumes

The second feature takes a different approach. Rather than controlling who can delete files, bindMountOptions controls what the mounted volume can do. The field sits on volumeMounts and accepts three Linux mount flags:

  • noexec — prevents execution of binaries from the mounted volume
  • nosuid — ignores setuid and setgid bits on files in the volume
  • nodev — ignores device special files
containers:
- name: app
  volumeMounts:
  - name: tmp
    mountPath: /tmp
    bindMountOptions: [noexec, nosuid]
volumes:
- name: tmp
  emptyDir: {}

This applies to any volume type — emptyDir, ConfigMap, PVC — not just temporary directories. If an attacker writes a binary to your /tmp emptyDir, noexec stops them from running it. It is a standard Linux hardening practice that was impossible to enforce at the pod spec level until now. The Kubernetes storage hardening post from September 16 walks through the threat model in detail.

One critical caveat: this feature requires your container runtime to support the mount_options field in the CRI Mount message. If the runtime does not advertise support, the kubelet rejects any pod that uses bindMountOptions. Verify containerd 2.1+ or CRI-O 1.32+ before enabling the VolumeBindMountOptions feature gate. Linux-only; no effect on Windows nodes. You can find the bind mount options configuration steps in the official Kubernetes documentation.

What Else Changed in Garhwal

DRA Extended Resource support is now GA. Dynamic Resource Allocation can now satisfy requests made through the traditional extended resource API — think example.com/gpu in a pod spec — without requiring a separate device plugin alongside the DRA driver. GPU teams can migrate away from device plugins without rewriting tenant manifests. DRA device taints and tolerations are also stable, letting you taint individual devices instead of cordoning entire nodes.

Native histograms graduated to Beta and are enabled by default. Kubernetes metrics now use Prometheus Native Histograms, delivering higher-resolution latency data at lower storage cost. If you are scraping Kubernetes metrics via Prometheus, you get better observability automatically after upgrading.

What to Check Before You Upgrade

SELinuxMount graduated to stable in v1.37 and is enabled by default. That is good for performance — the entire volume gets labeled in a single mount operation instead of recursively relabeling every file. It can break configurations where pods with different SELinux labels share the same PersistentVolume. Audit your multi-tenant storage before upgrading. The full Kubernetes v1.37 release notes document all breaking changes.

For the new alpha features:

  • Verify container runtime version before enabling VolumeBindMountOptions
  • Enable feature gates on both the API server and kubelet — one without the other does nothing
  • Run both features in test clusters before considering production use
  • The emptyDir mode field is silently ignored without the feature gate — pods will schedule normally

The emptyDir 0777 default has been a known problem since at least 2022. It took until Kubernetes v1.37 to land a fix. That is how open-source infrastructure sausage gets made — but at least now you can make your clusters safer.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *