Skip to content

Instantly share code, notes, and snippets.

@karael
Forked from FrankDeGroot/get-latest-kubectl.sh
Created October 26, 2016 02:27
Show Gist options
  • Save karael/6ba7fee569aa13d2d1ce83ee141141f7 to your computer and use it in GitHub Desktop.
Save karael/6ba7fee569aa13d2d1ce83ee141141f7 to your computer and use it in GitHub Desktop.
Get latest kubectl
#!/bin/bash
echo "Finding latest kubectl..."
# curl -s https://github.com/kubernetes/kubernetes/releases/latest | awk -F '[<>]' '/.*/ { match($0, "tag/([^\"]+)",a); print a[1] }'
LATEST=$(wget -qO- https://github.com/kubernetes/kubernetes/releases/latest | awk -F '[<>]' '/href="\/kubernetes\/kubernetes\/tree\/.*"/ { match($0, "tree/([^\"]+)",a); print a[1] }' | head -1)
echo "Getting $LATEST..."
sudo wget -NP /usr/bin http://storage.googleapis.com/kubernetes-release/release/$LATEST/bin/linux/amd64/kubectl
sudo chmod 755 /usr/bin/kubectl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment