Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can choose the wrong container based on unrealated volume mounts #66

Open
blowfishpro opened this issue Oct 14, 2021 · 0 comments
Open

Comments

@blowfishpro
Copy link

Steps to Reproduce

  • Have a pod with two containers, e.g. example1 and example2
  • Mount a ConfigMap into the example1 container with a name that contains example2
  • Attempt to profile the example2 container

Observed

  • You might actually choose the example1 container

Desired

  • If you specify a container you get that container

More info

We have a pod with containers named app and multiplexer, and a config map with the key app_env.json. I took a look at the mountinfo for one of the processes in the multiplexer container, and cross referencing with this logic I believe this line is being incorrectly matched on:

14828 14802 259:1 /var/lib/kubelet/pods/7a102c4a-964f-43a4-8477-8a5f1e7c99b4/volumes/kubernetes.io~configmap/app-env/..2021_09_14_22_01_44.499123521/app_env.json /volumes/settings/app_env.json ro,noatime - xfs /dev/nvme0n1p1 rw,attr2,inode64,logbufs=8,logbsize=32k,noquota

this is the line it's probably trying to match:

14820 14804 259:1 /var/lib/kubelet/pods/7a102c4a-964f-43a4-8477-8a5f1e7c99b4/containers/multiplexer/0216267a /dev/termination-log rw,noatime - xfs /dev/nvme0n1p1 rw,attr2,inode64,logbufs=8,logbsize=32k,noquota

As a result, I try to profile the app container but end up with data from the multiplexer container.

Maybe it should be stricter about matching e.g. /<pod_id>/containers/<container_name>/ ... I don't know how much of an assumption this is about the internals of the kubelet this is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant