diff --git a/runtime/kubernetes/container.go b/runtime/kubernetes/container.go index 4fa75d4..d4227ec 100644 --- a/runtime/kubernetes/container.go +++ b/runtime/kubernetes/container.go @@ -281,9 +281,15 @@ func (c *client) TailContainer(ctx context.Context, ctn *pipeline.Container) (io // // https://pkg.go.dev/k8s.io/api/core/v1?tab=doc#PodLogOptions opts := &v1.PodLogOptions{ - Container: ctn.ID, - Follow: true, - Previous: false, + Container: ctn.ID, + Follow: true, + // steps can exit quickly, and might be gone before + // log tailing has started, so we need to request + // logs for previously exited containers as well. + // Pods get deleted after job completion, and names for + // pod+container don't get reused. So, previous + // should only retrieve logs for the current build step. + Previous: true, Timestamps: false, }