kubectl exec truncates stdout without reporting error #124571
Labels
kind/bug
Categorizes issue or PR as related to a bug.
needs-triage
Indicates an issue or PR lacks a `triage/foo` label and requires one.
sig/cli
Categorizes an issue or PR as relevant to SIG CLI.
What happened?
When running a command with
kubectl exec
, the output (data written to stdout) can be truncated without the command returning an error. This results in ambiguity around the command failing or network being torn down with an error (non-zero exit code) versus the command completing successfully and returning complete output (exit code 0).Unsure what causes variation here, but probably related to network I/O speed and/or latency. Here's an example of drastic failures and inconsistencies on my machine:
If it doesn't reproduce for you, try adding some network latency or bandwidth restrictions, or increasing the amount of data that goes across the pipe. Visiting fast.com in a browser while running the tests, running more tests, and transferring more output (larger second value in the
seq
command) will help reproduce.What did you expect to happen?
I either:
How can we reproduce it (as minimally and precisely as possible)?
Run a command against a POD a number of times, see that the output always matches (it should):
If this doesn't reproduce try:
seq
Anything else we need to know?
This appears to have been a problem for a long time:
Kubectl appears to be discarding standard output
"kubectl exec" sometimes incorrectly returns empty string causing tests to flake
#34256] (closed w/ only workaround)
Kubernetes version
Also reproduces with (all permuatations of) client version 1.29, server version v1.27.11-eks-b9c9ed7:
Also reproed with:
Cloud provider
Reproduces against both AWS and GCP managed k8s.
OS version
I am on OS X.
Didn't have anyone handy not on OS X to try to repro.
Install tools
No response
Container runtime (CRI) and version (if applicable)
No response
Related plugins (CNI, CSI, ...) and versions (if applicable)
No response
The text was updated successfully, but these errors were encountered: