kolla-kubernetes/tools/setup-kubectl.sh
Ryan Hallisey 5b3db1c8d9 Add a script that will get the latest kubectl
Getting the latest kubectl is a pain to copy and paste
from the docs. Instead, added a script that will find the latest
version and add it to /usr/bin/kubectl.

Change-Id: I86011b3ab2f8f79684fb3ec6fb5b3b4c8f2dc4f7
Partially-implements: blueprint documentation-initialization
2016-08-29 20:39:13 -04:00

11 lines
608 B
Bash
Executable File

#!/bin/bash
# https://gist.github.com/FrankDeGroot/8cbec84eabfebcf2f2e7
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 kubectl-$LATEST"
sudo wget -NP /usr/bin http://storage.googleapis.com/kubernetes-release/release/$LATEST/bin/linux/amd64/kubectl
sudo chmod 755 /usr/bin/kubectl