NewNow in the Krew index: kubectl krew install memlens

What fills this Pod?

Kubernetes tells you memory is high. KubeMemLens splits each Pod's charge into anonymous memory, file cache, shmem and residual, and shows the cgroup evidence behind it.

No cluster yet? Try the built-in samples · v1.0.6 release notes · Tested on AWS EKS

KubeMemLens main dashboard in a terminal, listing 13 Pods with memory composition, limits and the selected Pod's details

Five samples. No cluster needed.

The CLI ships with five cgroup v2 samples. Pick one to see the breakdown and the diagnosis it prints, with the same figures.

Choose a sample

4.10 GiB charged to the Pod

Diagnosis
cache-heavy
Confidence
medium
Anonymous (anon)
1.20 GiB
File cache
2.51 GiB
Shmem / tmpfs
90.00 MiB
Residual / other
307.20 MiB

Filesystem-backed cache, excluding shmem, is 61% of total charged memory. This does not look like a pure application heap leak. File cache is high and active.

$ kubectl memlens sample explain cache-heavy

2.40 GiB charged to the Pod

Diagnosis
rss-heavy
Confidence
medium
Anonymous (anon)
2.00 GiB
File cache
180.00 MiB
Shmem / tmpfs
40.00 MiB
Residual / other
189.60 MiB

Anonymous memory is 83% of total charged memory. This suggests application heap, runtime heap growth or retained allocations. Use runtime heap tooling first.

$ kubectl memlens sample explain rss-heavy

3.00 GiB charged to the Pod

Diagnosis
tmpfs-heavy
Confidence
medium
Anonymous (anon)
900.00 MiB
File cache
0 B
Shmem / tmpfs
1.60 GiB
Residual / other
533.60 MiB

Shmem / tmpfs is 53% of total charged memory. Memory-backed files such as tmpfs, /dev/shm or memory-backed emptyDir volumes are a major part of the charge.

$ kubectl memlens sample explain tmpfs-heavy

2.20 GiB charged to the Pod

Diagnosis
dirty-writeback-heavy
Confidence
medium
Anonymous (anon)
800.00 MiB
File cache
974.00 MiB
Shmem / tmpfs
50.00 MiB
Residual / other
428.80 MiB

Dirty and writeback pages are 18% of total charged memory. This suggests a write-heavy workload, slow writeback or storage pressure. Check the write path first.

$ kubectl memlens sample explain dirty-heavy

900.00 MiB charged to the Pod

Diagnosis
normal
Confidence
low
Anonymous (anon)
500.00 MiB
File cache
230.00 MiB
Shmem / tmpfs
20.00 MiB
Residual / other
150.00 MiB

No dominant cgroup memory bucket was detected. One snapshot found no dominant signal. Absence of evidence is not evidence of healthy history.

$ kubectl memlens sample explain normal
  • Built into the CLI from v1.0.3.
  • Real cgroup v2 fixtures from the repository.
  • Figures exactly as the command prints them.

memory.stat

cache-heavy sample

memory.current 4,402,341,478 bytes

  • anon1,288,490,189
  • file2,791,728,742
  • shmem94,371,840
  • kernel188,743,680
  • active_file2,362,232,013
  • inactive_file398,458,880
  • file_dirty4,194,304

Diagnosis cache-heavy · confidence medium

Straight from the cgroup.

Every figure comes from the Pod's own memory.stat and memory.current. 61% of this Pod is file cache, so it does not look like a heap leak.

  • Read-only. It never changes your workloads.
  • Evidence and caveats beside every diagnosis.
  • OOM, memory.high, memory.max and PSI signals from the current sample.
  • Confidence stays honest: one snapshot is a heuristic.

Three commands. All read-only.

# Find the Pods with the strongest memory signals$ kubectl memlens top pods -A --sort-by cache # Explain one: composition, limits, pressure, evidence$ kubectl memlens explain pod api-123 -n production # Keep a redacted incident capture$ kubectl memlens capture -n production --pod api-123 --include-history -o incident.json$ 
  • Find. Bring the Pods with the strongest memory signals to the top.
  • Explain. Inspect composition, limits, pressure and the evidence behind the diagnosis.
  • Preserve. Write a redacted incident capture that you can review and compare.

Stay in the terminal from signal to evidence. KubeMemLens reports evidence and caveats; it never changes your workloads.

Similar totals. Different memory.

Follow two Pods from the overview into their memory breakdown. Press Enter to inspect a Pod and Esc to return to your selection.

55 seconds · 4K · SilentDownload video

The video has no audio. Its on-screen walkthrough shows:

  1. Select demo-assets-cache in the main dashboard and press Enter.
  2. Inspect its composition: 84% file cache and 14% anonymous memory.
  3. Move between panels with Tab and open suggested checks. These are hints; nothing runs automatically.
  4. Press Esc to return to the same selected Pod, then open demo-upload-buffer.
  5. Compare the similar totals: about 76 MiB and 75 MiB. The second Pod is 85% shared memory / tmpfs.

Tested on AWS EKS.

Memory inspection, capture and replay, access isolation, recovery and cleanup were exercised on AWS EKS. Use KubeMemLens in your workflow and tell us what you find.

  • AWS EKS

    AL2023 · containerd · amd64 · two managed nodes

    Tested
  • Linux and cgroup v2

    Reads cgroup v2 accounting on Linux nodes

    Required
  • Everything else

    Each supported and unsupported combination

    Contract

Install it in one command.

v1.0.6 reads each Pod's own cgroup, so a Pod's limit is the one the kernel enforces. It names the container closest to its own limit, and default incident captures now alias every name. Some output changed, so read the release notes before you upgrade.

In the cluster · Helm · signed v1.0.6 image
helm upgrade --install kube-memlens \
  oci://ghcr.io/danushkastanley/charts/kube-memlens \
  --version 1.0.6 \
  --namespace kube-memlens \
  --create-namespace \
  --set-string image.repository=ghcr.io/danushkastanley/kube-memlens \
  --set-string image.digest=sha256:4f47304afe3cf64e86c7a108378c9d7f3ea2c2ff5ddf69952129069248f0392a
On your machine · kubectl plugin
  • KrewAny platform

    kubectl krew install memlens
  • HomebrewmacOS, Linux

    brew install danushkastanley/tap/kubectl-memlens
  • ScoopWindows

    scoop bucket add kubememlens https://github.com/danushkastanley/scoop-bucket
    scoop install kubememlens/kubectl-memlens

  • Krew index

    The memlens plugin in the official kubectl plugin index

  • Homebrew tap

    Formula written from the release's signed checksums

  • Scoop bucket

    Manifest for Windows on amd64 and arm64

  • Artifact Hub

    The Helm chart, listed as a verified publisher