Summary
This article shows how to capture network traffic from a Dremio pod running in Kubernetes with tcpdump, which is not included in the Dremio container image. It covers two methods:
- Add a tcpdump sidecar container to a Dremio StatefulSet. This restarts every pod in the StatefulSet.
- Run an ephemeral debug container on a running pod. This needs no restart.
Reported Issue
Network communication between a Dremio pod and a data source fails, or inter-pod communication (for example coordinator to executor) is unreliable. To find the cause you need to analyze the traffic leaving and entering the pod.
Overview
The goal is a packet capture from inside a Dremio pod that you can read yourself or attach to a support ticket. Choose the method that fits your tolerance for restarts:
| Method | Restarts pods | Best for |
|---|---|---|
| Sidecar container | Yes, every pod in the StatefulSet | Capturing over a long period or across several pods |
| Ephemeral debug container | No | Quick, on-the-fly capture on a single pod |
Relevant Versions
All versions.
Steps to Resolve
Method 1: Add a tcpdump sidecar
Note: This method restarts every pod in the StatefulSet, so it can disrupt running workloads. Use the ephemeral container method below if you cannot afford a restart.
-
Confirm all pods are healthy:
kubectl get pods -n <namespace>
-
Create a patch file that adds the tcpdump sidecar:
cat <<EOF > patch.yaml spec: template: spec: containers: - name: tcpdumper image: docker.io/dockersec/tcpdump EOF -
Apply the patch to the StatefulSet and wait for the rollout to finish:
kubectl patch statefulset dremio-executor -n <namespace> --patch "$(cat patch.yaml)" kubectl rollout status statefulset/dremio-executor -n <namespace>
Each executor pod restarts in turn. When the rollout completes, you see a message similar to
partitioned roll out complete: 2 new pods have been updated.... -
Confirm the sidecar was added. The
tcpdumpercontainer should be listed withState: Running:kubectl describe pod dremio-executor-0 -n <namespace>
-
Read the capture. The sidecar writes to STDOUT, so tail the container logs:
kubectl logs -n <namespace> pod/dremio-executor-1 -c tcpdumper -f
Each line is one packet, for example:
15:08:15.135188 IP dremio-executor-0.dremio-cluster-pod.<namespace>.svc.cluster.local.54562 > dremio-executor-1.dremio-cluster-pod.<namespace>.svc.cluster.local.45678: Flags [P.], seq 3203020:3203041, ack 3080716, length 21
Use the usual command-line tools to filter the output, or redirect it to a file, for example
kubectl logs -n <namespace> pod/dremio-executor-1 -c tcpdumper > executor-1-tcpdump.txt. -
When you are done, remove the sidecar by rolling back the patch. This restarts every pod in the StatefulSet again:
kubectl rollout undo statefulset/dremio-executor -n <namespace> kubectl rollout status statefulset/dremio-executor -n <namespace>
Method 2: Run an ephemeral debug container
An ephemeral container attaches to a running pod without restarting it, so it is less intrusive. It shares the pod's network, so it sees the same traffic as the Dremio container.
-
Start a shell in an ephemeral tcpdump container, where
dremio-executorafter--targetis the name of the container you want to inspect:kubectl debug -n <namespace> -it pod/dremio-executor-0 --image=dockersec/tcpdump --target dremio-executor -- sh
-
Run tcpdump as normal from that shell.
Alternatively, run a single tcpdump command and send its output straight to your terminal. This example captures traffic on port 2181 (ZooKeeper):kubectl debug -n <namespace> -it pod/dremio-executor-0 --image=dockersec/tcpdump --target dremio-executor -- tcpdump -n -i any -s0 -v port 2181
The flags are:
-nskip name lookups,-i anycapture on all interfaces,-s0capture full packets,-vverbose output.
Kubernetes does not allow ephemeral containers to be removed from a running pod. The container stops when you exit, and disappears from the pod spec the next time the pod restarts.
Common Challenges
Note: You may find that the rollback results in pods stuck in terminating, this appears due to the tcpdump process failing to accept the SIGKILL (you will see the tcpdump sidecar continue to log as before). In this event, scale the statefulset to 0 then back up to cleanly finish the rollback per below examples.
$ kubectl scale statefulset/dremio-executor --replicas=0 -n <namespace>
statefulset.apps/dremio-executor scaled
$ kubectl scale statefulset/dremio-executor --replicas=2 -n <namespace>
statefulset.apps/dremio-executor scaledAdditional Resources
https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/
https://github.com/nicolaka/netshoot