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

I copied a file into pod and put it under /opt. You can see it with exEC-it, but you can't see it with debug. #116

Open
ghost opened this issue Jul 22, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 22, 2020

Exec -it can see this file

root@web-0-f449b476d-w95ms:/opt# ls
dns-test

You can't see this file with Debug

 kubectl debug web-0-f449b476d-w95ms -n kube-system -a
Agent Pod info: [Name:debug-agent-pod-9917540e-cc0c-11ea-912f-005056872b09, Namespace:default, Image:aylei/debug-agent:latest, HostPort:10027, ContainerPort:10027]
Waiting for pod debug-agent-pod-9917540e-cc0c-11ea-912f-005056872b09 to run...
pulling image nicolaka/netshoot:latest... 
latest: Pulling from nicolaka/netshoot
Digest: sha256:04786602e5a9463f40da65aea06fe5a825425c7df53b307daa21f828cfe40bf8
Status: Image is up to date for nicolaka/netshoot:latest
starting debug container...
container created, open tty...
bash-5.0# pwd
/
bash-5.0# cd /root/
bash-5.0# pwd
/root
bash-5.0# cd /opt/
bash-5.0# ls
bash-5.0# pwd
/opt
bash-5.0# ls
@kchenzhi
Copy link
Contributor

kchenzhi commented Aug 6, 2020

Pod's file namespace is difference from debug container's file namespace.

Firstly, use command ps -elf to determin the pid of your pod's main thread.
Then find the pod's /root dir at /proc/${pid}/root/

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