@ligc: Reiterating the mentions to trigger a notification:
@kubernetes/sig-cli-misc.
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.![]()
This I have on Windows 10 WSL, when trying to run kubectl.exe windows version.
Has anyone found a workaround for this issue? I am running Kubernetes GitVersion:"v1.6.3" on Linux minsky1 3.10.0-514.16.1.el7.ppc64le #1 SMP Fri Mar 10 13:08:23 EST 2017 ppc64le ppc64le ppc64le GNU/Linuxand I get the same error message when run ku exec -it sparkmaster-4180548331-b3lkq bash with just Unable to use a TTY - input is not a terminal or the right kind of file and the terminal just hanging there...
Is there no other way to attach to a running pod?
@alexandercampbell @shiywang Will one of you have bandwidth to look into this issue?
Same here, running minikube on windows 10
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-06-29T23:1
5:59Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.5", GitCommit:"5a0a696437ad35c133c0c8493f7e9d22b0f9b81b", GitTreeState:"clean", BuildDate:"1970-01-01T00:0
0:00Z", GoVersion:"go1.7.1", Compiler:"gc", Platform:"linux/amd64"}
Getting the same while trying to use alias:
alias kexecp='{ pod=$(cat -); k exec -it $pod --context=prod -- sh; }<<<'
then:
% kexecp some-app Defaulting container name to some-app. Use 'kubectl describe pod/some-app' to see all of the containers in this pod. Unable to use a TTY - input is not a terminal or the right kind of file
—
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale
Same problem using an alias on mac, converted it to a bash function and it worked:
kshell() { serverName=$(kubectl get pods | cut -d" " -f1 | grep server) kubectl exec -it $serverName ash --namespace=<namespace> }
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale
Any solution yet ?
I am facing the same problem while executing through Jenkins terminal.
Same issue when trying to pipe to xargs:
kubectl get pods -n foobar | grep baz | awk '{print $1}' | xargs -J % kubectl exec -it -n foobar % /bin/bash
@handlers I've been scratching my head on this one for a long time myself, and the -oflag is just what I needed. Though, the-ois on xargs, notkubectl exec` if anyone else reading it was a bit confused by that.
Updated the comment @chancez!
@hemantaltair did you get a workaround for jenkins terminal?
Have the same issue using MobaXterm (cgywin)
> kubectl exec --namespace=default -it hello-world-65c6847588-qnhqd /bin/sh
Unable to use a TTY - input is not a terminal or the right kind of file
—
while working with Jenkins, I kept getting the error Unable to use a TTY - input is not a terminal or the right kind of file because the pod was not yet in a ready state. We had to write a script to check make sure the state of the pod is Running
I can reproduce this behavior in Windows 7 Professional 64 bit in both
The minikube is a fresh v0.28.0 install
$ minikube version minikube version: v0.28.0
I use a command as seen in this kubernetesbyexample.com, part "Pods"
$ kubectl exec twocontainers -c shell -i -t -- bash
Unable to use a TTY - input is not a terminal or the right kind of file—
got the same problem with kubectl on cygwin, i dont get a prompt but the shell gives response to commands. any ideas how to fix this?
{ ~ } » kubectl exec -it iscsi-provisioner-7f46d96b8c-jt6rc -- /bin/sh ~ 130
Unable to use a TTY - input is not a terminal or the right kind of file
ls -al /root
total 36
dr-xr-x--- 2 root root 4096 Sep 11 2017 .
drwxr-xr-x 1 root root 4096 Jul 11 22:49 ..
-rw-r--r-- 1 root root 18 Dec 29 2013 .bash_logout
-rw-r--r-- 1 root root 176 Dec 29 2013 .bash_profile
-rw-r--r-- 1 root root 176 Dec 29 2013 .bashrc
-rw-r--r-- 1 root root 100 Dec 29 2013 .cshrc
-rw-r--r-- 1 root root 129 Dec 29 2013 .tcshrc
-rw------- 1 root root 3407 Sep 11 2017 anaconda-ks.cfg
-rw------- 1 root root 3221 Sep 11 2017 original-ks.cfg
cat /root/.bashrc
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
Same issue but winpty kubectl.exe exec -it <pod> -- bash worked for me as a workaround - see Microsoft/WSL#2271 (comment).
taking out -t flag from the command solved it for me.
this work for me:
kubectl get pods | perl -alne 'print $F[0] if $F[0] =~ /toolkit/' | xargs -o -I {} kubectl exec -it {} -c toolkit sh
Facing the same issue on Git Bash Terminal on Windows 7:
kubectl exec -it <pod_name> bash
But, the same works on cmd, powershell and Docker Terminal.
Same issue using MobaXterm (cygwin) and
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.0", GitCommit:"0ed33881dc4355495f623c6f22e7dd0b7632b7c0", GitTreeState:"clean", BuildDate:"2018-09-27T17:05:32Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"windows/amd64"}```
/sig windows
Reproduced issue on Windows 10 running Git Bash for Windows.
`$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:17:39Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.6", GitCommit:"b1d75deca493a24a2f87eb1efde1a569e52fc8d9", GitTreeState:"clean", BuildDate:"2018-12-16T04:30:10Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
$ uname -a
MINGW64_NT-10.0 KYLE-PC 2.8.2(0.313/5/3) 2017-07-12 15:35 x86_64 Msys`
The error message appears when using the "-t" flag.
Whether or not the "-t" flag is used, no bash prompt appears, although I am still able to enter and process bash commands.
I don't think we can fix this. It seems like an issue in the Git bash environment only. This works in WSL, and it works with the native Windows binary. I would recommend opening an issue with the Git-SCM.org team that provides that bash shell.
Windows Users: use "Windows PowerShell", not "GitBash"
I can't make it, so use the shell.
kubectl get po |awk 'NR>1{print $1}'|while read i;do echo "echo " $i >> 2; echo kubectl exec -it $i -- ping db-com -c 1 2>&1 |grep from|awk '{print $4}' >> 2;done
Use winpty kubectl exec -it bash
Same problem with us:
bash -c "./kubectl --kubeconfig .kube/config exec -i -t $(./kubectl --kubeconfig .kube/config get pods -n adaptive-admin-be -l workload.user.cattle.io/workloadselector=deployment-adaptive-admin-be-adaptive-admin-be -o=custom-columns=:metadata.name --no-headers) -n adaptive-admin-be -- bash -c \"cd app && ../vendor/phalcon/devtools/phalcon migration run\""
and then
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: "adaptive-admin-be-65fd7cdc86-vc2t8": executable file not found in $PATH": unknown
Only started a few days ago before that all was good.
Apparently this is a docker bug.
kubectl exec internally invokes the terminal component included in the docker engine but their implementation (using GetConsoleMode to judge if a file handle is a tty) does not detect fake Windows terminals including Git bash and Cygwin bash as a valid tty.
The most straightforward fix would be to replace GetConsoleMode with this but maybe the check itself (IsTerminal) could be removed provided it does not break anything.
we ran into the same issue, however if you are running it from Command Prompt ( cmd.exe ) .. it was working like a charm
@albertlr As I mentioned this is probably not a Kubernetes bug. The terminal package within the docker engine is currently being incapable of detecting fake terminals like Git bash and Cygwin terminal. This issue does not reproduce on cmd.exe because it is a real terminal, for which GetConsoleMode returns TRUE. Adding a special detection logic like this one to the docker engine will fix the issue but there is nothing that can be done here except removing the check altogether.
If you don't like solution from @nick-pap you can define alias:
$> alias kubectl='winpty kubectl'
and then use
$> kubectl exec -it test sh
as usual.
Git bash works like Unix shell and it uses stdin and stdout streams to communicate with kubectl, however in Windows with Git bash you are using actually kubectl.exe that expects Windows console and not Unix streams. Winpty solves this problem.
If you want to make the change permanent put the alias into ~/.bash_profile file.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
If you don't like solution from @nick-pap you can define alias:
$> alias kubectl='winpty kubectl'
and then use
$> kubectl exec -it test sh
as usual.Git bash works like Unix shell and it uses stdin and stdout streams to communicate with kubectl, however in Windows with Git bash you are using actually kubectl.exe that expects Windows console and not Unix streams. Winpty solves this problem.
If you want to make the change permanent put the alias into ~/.bash_profile file.
Unfortunate that is nor working for me. Using winpty just immediately ends kubectl. No error, no console, nothing.
taking out -t flag from the command solved it for me.
very good
removing -t is not a solution permanently. because when I got the same error I also used this suggestion of removing of -t, but in that case whatever command we are passing in next line it do not shows in output see:
--> here it should be showing output for ls -lrth, do anyone still has best solution to it ?
Same issue using Babun (cygwin)
{ ~ } » kubectl version ~
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.7", GitCommit:"c83d931fb9bece427bc63a02349755e0f8696d3e", GitTreeState:"clean", BuildDate:"2020-01-31T20:09:49Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
{ ~ } » uname -a ~
CYGWIN_NT-10.0-WOW FRWKS020760 1.7.35(0.287/5/3) 2015-03-04 12:07 i686 Cygwin
{ ~ } » kubectl exec -i -t aks-ssh /bin/bash ~
Unable to use a TTY - input is not a terminal or the right kind of file
—
same issue with me as well
$ kubectl exec -it nfs-server -n testnm -- bash
Unable to use a TTY - input is not a terminal or the right kind of file
same issue here:
ran from Win CMD
kubectl version v1.18.0
minkube version 1.9.2
If it is possible because I don't have docker installed on WIN machine whatsoever?
The original issue mentions "Ubuntu" as the OS, how the hell did it derail into "Windows" issue?
People, try to read the context and create another issue if your systems are not similar enough, please.
Facing the same issue on Git Bash Terminal on Windows 7:
kubectl exec -it <pod_name> bashBut, the same works on cmd, powershell and Docker Terminal.
Thank you, @Rakitic07 ! I had the same problem in Git Bash Terminal on Windows 10. On your suggestion, I tried successfully in PoewerShell.
I'm using MINGW64. Like @santmcodes, I solved the problem by prefixing it with winpty.
$ winpty kubectl exec -it my-pod -- bash
root@my-pod:/# ls -l total 52 lrwxrwxrwx 1 root root 7 Sep 25 01:20 bin -> usr/bin drwxr-xr-x 2 root root 4096 Apr 15 2020 boot drwxr-xr-x 5 root root 360 Oct 19 13:34 dev drwxr-xr-x 1 root root 4096 Oct 19 13:34 etc drwxr-xr-x 2 root root 4096 Apr 15 2020 home
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
For GIT bash terminal, this works:
winpty kubectl exec -it bash
—
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
/remove-lifecycle rotten
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale is appliedlifecycle/stale was applied, lifecycle/rotten is appliedlifecycle/rotten was applied, the issue is closedYou can:
/remove-lifecycle stale/lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
![]()
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale is appliedlifecycle/stale was applied, lifecycle/rotten is appliedlifecycle/rotten was applied, the issue is closedYou can:
/remove-lifecycle stale/lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale is appliedlifecycle/stale was applied, lifecycle/rotten is appliedlifecycle/rotten was applied, the issue is closedYou can:
/remove-lifecycle stale/lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are on a team that was mentioned.![]()
/remove-lifecycle stale
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are on a team that was mentioned.![]()
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale is appliedlifecycle/stale was applied, lifecycle/rotten is appliedlifecycle/rotten was applied, the issue is closedYou can:
/remove-lifecycle stale/lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
/remove-lifecycle stale
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale is appliedlifecycle/stale was applied, lifecycle/rotten is appliedlifecycle/rotten was applied, the issue is closedYou can:
/remove-lifecycle stale/lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
/remove-lifecycle stale
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale is appliedlifecycle/stale was applied, lifecycle/rotten is appliedlifecycle/rotten was applied, the issue is closedYou can:
/remove-lifecycle stale/lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale is appliedlifecycle/stale was applied, lifecycle/rotten is appliedlifecycle/rotten was applied, the issue is closedYou can:
/remove-lifecycle rotten/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
/remove-lifecycle stale
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
lifecycle/stale is appliedlifecycle/stale was applied, lifecycle/rotten is appliedlifecycle/rotten was applied, the issue is closedYou can:
/reopen/remove-lifecycle rottenPlease send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
Closed #37471 as not planned.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
/reopen
/remove-lifecycle rotten
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()
@TerjeBr: You can't reopen an issue/PR unless you authored it or you are a collaborator.
In response to this:
/reopen
/remove-lifecycle rotten
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are on a team that was mentioned.![]()