Skip to content

Instantly share code, notes, and snippets.

@FrankDeGroot
Last active October 26, 2016 02:27
Show Gist options
  • Save FrankDeGroot/8cbec84eabfebcf2f2e7 to your computer and use it in GitHub Desktop.
Save FrankDeGroot/8cbec84eabfebcf2f2e7 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