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

if my target pods is kubernetes coredns, i can not find shared pid and mnt namespace, Because there is no shell, command line operations cannot be executed #43

Open
sun363587351 opened this issue May 7, 2024 · 5 comments

Comments

@sun363587351
Copy link

[root@master ~]# cdebug exec --namespace=kube-system -it pod/coredns-5cd85ddb9f-ls5dl
Debugger container name: cdebug-47f86597
Starting debugger container...
Waiting for debugger container...
Attaching to debugger container...
If you don't see a command prompt, try pressing enter.
/ # ps aux
PID USER TIME COMMAND
1 root 0:00 sh /.cdebug-entrypoint.sh
11 root 0:00 sh
12 root 0:00 ps aux

@sun363587351
Copy link
Author

if i use kubectl debug ,i can find shared pid and mnt namesapce.
kubectl debug coredns-5cd85ddb9f-ls5dl -it --image=netshoot --image-pull-policy=IfNotPresent --target=coredns -n kube-system
coredns-5cd85ddb9f-ls5dl  ~  ps aux
PID USER TIME COMMAND
1 root 3:01 /coredns -conf /etc/coredns/Corefile
55 root 0:01 zsh
119 root 0:00 ps aux

@iximiuz
Copy link
Owner

iximiuz commented May 7, 2024

Thanks for the report! The reason for you not seeing the expected processes is because you're targeting the Pod and not the concrete container inside of it. Could you try cdebug exec --namespace=kube-system -it pod/coredns-5cd85ddb9f-ls5dl/coredns instead? (notice the /coredns addition).

@sun363587351
Copy link
Author

Thanks for the report! The reason for you not seeing the expected processes is because you're targeting the Pod and not the concrete container inside of it. Could you try cdebug exec --namespace=kube-system -it pod/coredns-5cd85ddb9f-ls5dl/coredns instead? (notice the /coredns addition).

I do it,but doesn't works. and it say no coredns

@iximiuz
Copy link
Owner

iximiuz commented May 11, 2024

Could you please provide the output of the kubectl -n kube-system get pod coredns-5cd85ddb9f-ls5dl -o yaml command?

@long904
Copy link

long904 commented Aug 25, 2024

cdebug exec -it --image busybox:musl --namespace=kube-system pod/coredns-c97d8fd78-kg4s5/coredns

Debugger container name: cdebug-860ce1e2
Starting debugger container...
Waiting for debugger container...
sh: can't open no: no such file
cdebug: Debugger container "cdebug-860ce1e2" terminated: Error - (exit code: 1).

Ran into the same problem, getting into the coredns container reported an error. If you don't add coredns, there is no problem

Thanks for the report! The reason for you not seeing the expected processes is because you're targeting the Pod and not the concrete container inside of it. Could you try cdebug exec --namespace=kube-system -it pod/coredns-5cd85ddb9f-ls5dl/coredns instead? (notice the /coredns addition).

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

3 participants