Skip to content

Commit

Permalink
Update install-kubectl.sh
Browse files Browse the repository at this point in the history
Checks and applies correct CPU architecture.
  • Loading branch information
ErikHeggeli authored Oct 4, 2024
1 parent a06de90 commit 4e24760
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/install-kubectl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ umask 077
api_url="https://storage.googleapis.com/kubernetes-release/release"
version="$(curl -s ${api_url}/stable.txt)"
platform="$(uname -s | tr "[:upper:]" "[:lower:]")"
arch="$(uname -m)"
if [ "$arch" = "x86_64" ]; then
arch="amd64"
elif [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
arch="arm64"
else
echo "Unsupported architecture: $arch"
exit 1
fi

mkdir -p /tmp/kubectl && cd /tmp/kubectl
curl -LO "${api_url}/${version}/bin/${platform}/amd64/kubectl"
curl -LO "${api_url}/${version}/bin/${platform}/${arch}/kubectl"
chmod +x kubectl
sudo mkdir -p /usr/local/bin
sudo mv kubectl /usr/local/bin/

0 comments on commit 4e24760

Please sign in to comment.