Dnsmasq Container entering shell

114 Views Asked by At

Target: I want to enter the shell/bash of my dnsmasq-container inside of my kubernetes pod. I need to inspect the filesystem.

Problem: normally i use the command "kubectl exec -it /bin/bash" or with "/bin/sh"-ending. For the dnsmasq-container i have absolutely no idea.

kubectl exec -it zeppelin-server-5b5fc99cbb-9ndvz dnsmasq /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
Defaulted container "zeppelin-server" out of: zeppelin-server, zeppelin-server-gateway, dnsmasq
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "dnsmasq": executable file not found in $PATH: unknown
command terminated with exit code 126

Sources: https://zeppelin.apache.org/docs/0.10.1/quickstart/kubernetes.html This Deployment contains zeppelin, nginx and dnsmasq.

1

There are 1 best solutions below

0
dontoronto On BEST ANSWER

I solved it.

Solution: If there are multiple container inside of a pod, we have to specify the container with a special "--container"-Flag. With this method I was able to enter the dnsmasq container.

I found the solution here: https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/

Syntax of the right command:

kubectl exec -i -t my-pod --container main-app -- /bin/bash