cdebug icon indicating copy to clipboard operation
cdebug copied to clipboard

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

Open sun363587351 opened this issue 1 year ago • 5 comments

[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 avatar May 07 '24 03:05 sun363587351

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

sun363587351 avatar May 07 '24 03:05 sun363587351

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).

iximiuz avatar May 07 '24 12:05 iximiuz

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

sun363587351 avatar May 11 '24 14:05 sun363587351

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

iximiuz avatar May 11 '24 15:05 iximiuz

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).

long904 avatar Aug 25 '24 10:08 long904