title: How to get Java Heap Dump from a Kubernetes Pod using jmap?
body: <p>I was following the steps mentioned here <a href="https://stackoverflow.com/questions/64121941/how-to-get-a-heap-dump-from-kubernetes-k8s-pod">How to get a heap dump from Kubernetes k8s pod?</a></p>
  <p>I'm able to get the the process id using top command inside the pod. However, when I run jmap I get this:</p>
  <pre><code>~ $ jmap
  sh: jmap: not found
  </code></pre>
  <p>I access the pod with this command: kubectl exec -it  -- sh</p>
  <p>I also tried this command:</p>
  <pre><code>kubectl exec -it &lt;pod&gt; -- jmap -dump:live,format=b,file=heapdump.bin 1
  </code></pre>
  <p>But I was getting:</p>
  <pre><code>OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused &quot;exec: \&quot;jmap\&quot;: executable file not found in $PATH&quot;: unknown command terminated with exit code 126
  </code></pre>
  <p>Is there any other way to get the java heap dump from the pod?</p>