Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation of kubectl fails when using zsh #2566

Closed
1 of 2 tasks
psankar opened this issue Feb 17, 2017 · 17 comments
Closed
1 of 2 tasks

Installation of kubectl fails when using zsh #2566

psankar opened this issue Feb 17, 2017 · 17 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@psankar
Copy link

psankar commented Feb 17, 2017

This is a...

  • Feature Request
  • Bug Report

Problem:
I tried to install kubectl on a Mac OS machine and it fails. I followed the documentation at: https://kubernetes.io/docs/user-guide/prereqs/ and https://kubernetes.io/docs/tutorials/stateless-application/hello-minikube/ and gave a command. The command and the response are below:

➜  Downloads curl -LO https://storage.googleapis.com/kubernetes-release/release/$\(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt\)/bin/darwin/amd64/kubectl
<?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message></Error>%                                                                            
➜  Downloads

Proposed Solution:
Fix the documentation or the url

Page to Update:
https://kubernetes.io/docs/user-guide/prereqs/
https://kubernetes.io/docs/tutorials/stateless-application/hello-minikube/

@ixdy
Copy link
Member

ixdy commented Feb 17, 2017

@psankar Did you add the backslashes before ( and ) when you copied the command? I don't see those in the docs, but that's probably why it did not work for you.

This command should work:

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl

This will not, because the backslashes will cause the shell not to interpret the inner curl as a command:

curl -LO https://storage.googleapis.com/kubernetes-release/release/$\(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt\)/bin/darwin/amd64/kubectl

@psankar
Copy link
Author

psankar commented Feb 18, 2017

@ixdy ah yes. The backslashes are automatically inserted by zsh when I pasted the link. I think that this issue can be closed. But considering that many people may be using zsh, can a NOTE be added for this in the docs ?

@alaam
Copy link

alaam commented Mar 9, 2017

I agree with @psankar. I just ran into the same problem on zsh as well

@kawikadkekahuna
Copy link

kawikadkekahuna commented Mar 21, 2017

Was there any solution to this problem? Currently running into a similar problem:

<?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message></Error>%

@ixdy ixdy changed the title Installation of kubectl fails Installation of kubectl fails when using zsh Mar 21, 2017
@ixdy
Copy link
Member

ixdy commented Mar 21, 2017

This sounds like a bug in zsh, possibly zsh-users/zsh-autosuggestions#102.

@kawikadkekahuna
Copy link

@ixdy Thanks for the quick response. Running the command using bash resolved the issue.

Seems like zsh doesnt play nice after the second curl request. Running https://storage.googleapis.com/kubernetes-release/release/v1.5.4/bin/linux/amd64/kubectl should work as well.

@ixdy
Copy link
Member

ixdy commented Mar 21, 2017

@kawikadkekahuna what was the full command-line you used in zsh? In the OP it was clearly a zsh bug, since zsh auto-inserted backslashes where it shouldn't be.

@allan-fan
Copy link

allan-fan commented Apr 28, 2017

@zoidyzoidzoid
Copy link
Contributor

Wouldn't it still be best practise to double quote commands that use command substitution and change it from:

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl

to

curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl"

Google shell styleguide: Quoting

@ericfreese
Copy link

Maintainer of zsh-users/zsh-autosuggestions here. This likely had to do with zsh "bracketed-paste-magic" functionality, which Oh My Zsh enables by default.

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 6, 2018
@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 10, 2018
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@chaabraham
Copy link

/remove-lifecycle stale

@chaabraham
Copy link

getting this issue after trying without the slashes before ( & ):

➜ ~ curl -LO https://storage.googleapis.com/kubernetes-release/release/v10.13.3/bin/darwin/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 127 100 127 0 0 569 0 --:--:-- --:--:-- --:--:-- 569
Password:
➜ ~ kubectl cluster-info
/usr/local/bin/kubectl: line 1: syntax error near unexpected token <' /usr/local/bin/kubectl: line 1: NoSuchKeyThe specified key does not exist.'
➜ ~ kubectl
/usr/local/bin/kubectl: line 1: syntax error near unexpected token <' /usr/local/bin/kubectl: line 1: NoSuchKeyThe specified key does not exist.'
➜ ~

@ixdy
Copy link
Member

ixdy commented Mar 14, 2018

The version in the URL should match a kubernetes release, not the version of macOS you're using. Try something like v1.9.4 instead of v10.13.3 (which doesn't exist).

@bnjmnbrmn-work
Copy link

Should probably change curl -LO ... to something that will fail if you don't get a 200....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests