This is a...
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/
@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
@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 ?
I agree with @psankar. I just ran into the same problem on zsh as well
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>%
This sounds like a bug in zsh, possibly https://github.com/zsh-users/zsh-autosuggestions/issues/102.
@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.
@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.
There is a direct link to download the kubectl.exe file:
http://storage.googleapis.com/kubernetes-release/release/v1.5.3/bin/windows/amd64/kubectl.exe
More information can be found:
https://console.ng.bluemix.net/docs/containers/cs_cli_install.html#cs_cli_install
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"
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.
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
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
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
/remove-lifecycle stale
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:NoSuchKey
➜ ~ kubectl
/usr/local/bin/kubectl: line 1: syntax error near unexpected token <'
/usr/local/bin/kubectl: line 1:NoSuchKey
➜ ~
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).
Most helpful comment
Wouldn't it still be best practise to double quote commands that use command substitution and change it from:
to
Google shell styleguide: Quoting