Kubernetes is there an analogue to docker diff?

12/27/2017

I'm trying to figure out where a program run in a container stores its logs. But, I don't have SSH access to the machine which deployed container, only kubectl. Suppose I had SSH access, I'd do something like this:

ssh machine-running-docker 'docker diff \
    $(kubectl describe pod pod-name | \
      grep 'Conainer ID' | sed -E s#^[^/]+//(.+)$#\1#)'

(The regex may be imprecise, just to give the idea).

-- wvxvw
docker
kubectl
kubernetes

1 Answer

12/27/2017

Well, for starters, an app in container should not store it's logs in files inside container. That said, it is sometimes hard to avoid when you work with 3rd party apps not configured for logging to stdout / some logging service.

Good old find to the rescue - just kubectl exec into the pod/container and find / -mmin -1 will give you all files modified in last 1 min. That should narrow the list enough for you (assuming the container lived for few minutes already).

-- Radek 'Goblin' Pieczonka
Source: StackOverflow