Skip to content

Commit c9a7a35

Browse files
Scotttekton-robot
authored andcommitted
Document odd kubectl get output for pods w/ sidecars
With the current sidecar implementation `kubectl get pods` will show pods with successful sidecars as Completed but pods with errored sidecars as Error. It looks like the kubectl get pods printer code is just using the status of the last container in the container list as the source of the "Reason" that it prints for a pod ending. Seems a bit janky but ¯\_(ツ)_/¯ I'm documenting the behaviour rather than looking to fix it since there's are existing proposals to improve the sidecar implementation and this appears to simple be a UI/UX issue. The status of the TaskRun that generated the pod has the correct end status regardless of the output from `kubectl get pods`.
1 parent d7f492c commit c9a7a35

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

docs/developers/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,17 @@ with updated container image. The nop container image exits immediately
182182
The container is considered `Terminated` by Kubernetes and the TaskRun's Pod
183183
stops.
184184

185-
There is a known issue with this implementation of sidecar support. When the
186-
`nop` image does provide the sidecar's command, the sidecar will continue to
185+
There are known issues with the existing implementation of sidecars:
186+
187+
- When the `nop` image does provide the sidecar's command, the sidecar will continue to
187188
run even after `nop` has been swapped into the sidecar container's image
188189
field. See https://github.com/tektoncd/pipeline/issues/1347 for the issue
189190
tracking this bug. Until this issue is resolved the best way to avoid it is to
190191
avoid overriding the `nop` image when deploying the tekton controller, or
191192
ensuring that the overridden `nop` image contains as few commands as possible.
193+
194+
- `kubectl get pods` will show a Completed pod when a sidecar exits successfully
195+
but an Error when the sidecar exits with an error. This is only apparent when
196+
using `kubectl` to get the pods of a TaskRun, not when describing the Pod
197+
using `kubectl describe pod ...` nor when looking at the TaskRun, but can be quite
198+
confusing.

docs/taskruns.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,12 +590,21 @@ order to terminate the sidecars they will be restarted with a new
590590
Pod will include the sidecar container with a Retry Count of 1 and
591591
with a different container image than you might be expecting.
592592

593-
Note: The configured "nop" image must not provide the command that the
593+
Note: There are some known issues with the existing implementation of sidecars:
594+
595+
- The configured "nop" image must not provide the command that the
594596
sidecar is expected to run. If it does provide the command then it will
595597
not exit. This will result in the sidecar running forever and the Task
596598
eventually timing out. https://github.com/tektoncd/pipeline/issues/1347
597599
is the issue where this bug is being tracked.
598600

601+
- `kubectl get pods` will show a TaskRun's Pod as "Completed" if a sidecar
602+
exits successfully and "Error" if the sidecar exits with an error, regardless
603+
of how the step containers inside that pod exited. This issue only manifests
604+
with the `get pods` command. The Pod description will instead show a Status of
605+
Failed and the individual container statuses will correctly reflect how and why
606+
they exited.
607+
599608
---
600609

601610
Except as otherwise noted, the content of this page is licensed under the

0 commit comments

Comments
 (0)