Kubernetes 1.12 introduced process namespace sharing, which is the ability for containers in a pod to share the same process namespace. One of the neat things that you can do with this feature is to split your containers up into slim runtime containers, and optional debug containers that have all the tools required for troubleshooting.
For Java applications we want to use slimmed down JRE for our runtime container, but if things go sidewise, we want to use tools that are only available in the full JDK. Things like jmap, jstack, jps and friends.
I was curious to see if process namespace sharing would work for the JDK tools. It turns out it does.
Here is a sample that you can try out on Kubernetes >= 1.12 (this was tested in minikube). Follow the instructions to deploy this, and exec into the jdk container. Find the tomcat process using jps and then use jmap / jstack to debug the tomcat container.