kubernetes: `kubectl run` doesn’t work for simple "run command, parse result"
(source: user feedback)
First, it outputs Waiting for pod ...
which gets mingled with commands output. Second, simple output often gets lost.
1. -it, date: doesn’t work
$ kubectl run test --rm --restart=Never -it --image=ubuntu -- date
Waiting for pod default/test to be running, status is Pending, pod ready: false
Error from server: Unrecognized input header
2. -it, bash sleep, then date: works with output mingled with command output
$ kubectl run test --rm --restart=Never -it --image=ubuntu -- bash -c "sleep 3; date; sleep 3"
Waiting for pod default/test to be running, status is Pending, pod ready: false
Hit enter for command prompt
Fri Jul 8 17:19:50 UTC 2016
pod "test" deleted
3. -t, bash sleep, then date: doesn’t work
$ kubectl run test --rm --restart=Never -t --image=ubuntu -- bash -c "sleep 3; date; sleep 3"
error: -i/--stdin is required for containers with -t/--tty=true
See 'kubectl run -h' for help and examples.
4. -i, date: works but output is still mingled
$ kubectl run test --rm --restart=Never -i --image=ubuntu -- date
Waiting for pod default/test to be running, status is Pending, pod ready: false
Fri Jul 8 17:21:59 UTC 2016
pod "test" deleted
Compared to docker run
, all 4 cases return the same simple output:
$ docker run -i ubuntu date
Fri Jul 8 17:23:45 UTC 2016
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 19
- Comments: 53 (36 by maintainers)
Commits related to this issue
- Merge pull request #28801 from janetkuo/kubectl-run-silent Automatic merge from submit-queue Add --quiet to hide the 'waiting for pods to be running' message in kubectl run Ref #28695 @kuberne... — committed to kubernetes/kubernetes by k8s-github-robot 8 years ago
- Merge pull request #30247 from ardnaxelarak/28695_suppress_noisy_output Automatic merge from submit-queue Make more messages respect --quiet flag Make following two messages respect `--quiet` in `k... — committed to kubernetes/kubernetes by deleted user 8 years ago
- Merge pull request #30701 from ardnaxelarak/28695_suppress_noisy_output Automatic merge from submit-queue Add test for --quiet flag for kubectl run This adds a test for the changes introduced in #3... — committed to kubernetes/kubernetes by deleted user 8 years ago
- Merge pull request #31558 from MHBauer/match-raw-term-setting Automatic merge from submit-queue Use the rawTerminal setting from the container itself **What this PR does / why we need it**: Checks... — committed to kubernetes/kubernetes by deleted user 8 years ago
- Remove chatty "waiting for pod" msg from kubectl run Attacking #28695 one step at a time Signed-off-by: Doug Davis <dug@us.ibm.com> — committed to duglin/kubernetes by deleted user 8 years ago
- Remove chatty "waiting for pod" msg from kubectl run Attacking #28695 one step at a time Signed-off-by: Doug Davis <dug@us.ibm.com> — committed to duglin/kubernetes by deleted user 8 years ago
- Merge pull request #37164 from duglin/removeWaiting Automatic merge from submit-queue (batch tested with PRs 38413, 37164) Remove chatty "waiting for pod" msg from kubectl run Attacking #28695 one ... — committed to kubernetes/kubernetes by deleted user 8 years ago
- Merge pull request #38429 from duglin/removeDelete Automatic merge from submit-queue (batch tested with PRs 37860, 38429, 38451, 36050, 38463) Remove "pod xxx deleted" message from kubectl run --rm ... — committed to kubernetes/kubernetes by deleted user 8 years ago
- Fixing TTY attach with alpine + sleep 0.1 Kubectl run has an issue open for this: https://github.com/kubernetes/kubernetes/issues/28695 After this gets fixed we can go back to the scratch image — committed to banzaicloud/kurun by bonifaido 6 years ago
Still an issue in late 2020.
Has case 2 ever been fixed? Because I’m running into this now…
1 & 4 work as specified now.
2 still has the
Hit enter for command prompt
message and some weird spaces, but the only thing on stdout is the appropriate output. I’d be inclined to get rid of the message about the prompt.3 is the only weird behavior where it’s just different than docker.
Yes,
docker logs
is stdout/err of the container.This is what we used to have:
This is what we have now:
I like the idea of --quiet being implied with -i -t.
I also like the idea of an umbrella flag that covers it all. --interactive is the long-form of -i, though, isn’t it? How about --attached or –one-shot? Maybe --interactive is better.
Is there a use for -i that isn’t this? Maybe just -i -t together implies everything?
On Mon, Jul 11, 2016 at 5:14 PM, Janet Kuo notifications@github.com wrote: