Created
May 9, 2025 09:06
-
-
Save chrishham/f89bd628577b2793b4a404b893fd1a2b to your computer and use it in GitHub Desktop.
Install Azure CLI, kubectl, kubelogin and Helm to alpine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo ">>> Updating system and installing dependencies" | |
apk update && apk add --no-cache bash curl unzip tar ca-certificates openssl | |
ARCH="arm64" | |
K8S_VERSION="$(curl -sL https://dl.k8s.io/release/stable.txt)" | |
HELM_VERSION="$(curl -s https://api.github.com/repos/helm/helm/releases/latest | grep tag_name | cut -d '"' -f 4)" | |
KUBELOGIN_VERSION="$(curl -s https://api.github.com/repos/Azure/kubelogin/releases/latest | grep tag_name | cut -d '"' -f 4)" | |
# ---------------------------- | |
# Azure CLI via pip (Alpine-friendly) | |
# ---------------------------- | |
echo ">>> Installing Azure CLI (pip)" | |
apk add --no-cache py3-pip | |
pip install --upgrade pip | |
pip install azure-cli | |
# ---------------------------- | |
# kubectl | |
# ---------------------------- | |
echo ">>> Installing kubectl ($K8S_VERSION)" | |
curl -LO "https://dl.k8s.io/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl" | |
install -m 0755 kubectl /usr/local/bin/kubectl | |
rm kubectl | |
# ---------------------------- | |
# kubelogin | |
# ---------------------------- | |
echo ">>> Installing kubelogin ($KUBELOGIN_VERSION)" | |
curl -LO "https://github.com/Azure/kubelogin/releases/download/${KUBELOGIN_VERSION}/kubelogin-linux-${ARCH}.zip" | |
unzip kubelogin-linux-${ARCH}.zip | |
install -m 0755 bin/linux_${ARCH}/kubelogin /usr/local/bin/kubelogin | |
rm -rf kubelogin-linux-${ARCH}.zip bin | |
# ---------------------------- | |
# helm | |
# ---------------------------- | |
echo ">>> Installing Helm ($HELM_VERSION)" | |
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" | |
tar -zxvf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz | |
install -m 0755 linux-${ARCH}/helm /usr/local/bin/helm | |
rm -rf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz linux-${ARCH} | |
echo ">>> All tools installed successfully!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment