I built a kubectl plugin that solves this exact problem!
kubectl-execrec is a transparent wrapper around kubectl exec that captures all commands and output. Just replace kubectl exec
with kubectl execrec
and everything gets logged to timestamped files.