Created
March 15, 2023 07:41
-
-
Save ruzickap/913af024ba4546ad4556dae32a90646d to your computer and use it in GitHub Desktop.
Deploy Azure AKS with Cilium
This file contains 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
#!/usr/bin/env bash | |
export AZURE_LOCATION="westeurope" | |
export CLUSTER_FQDN="ruzickap1aks.k8s.mylabs.dev" | |
# CLUSTER_NAME must have max 12 character due to "--nodepool-name" parameter | |
export CLUSTER_NAME="${CLUSTER_FQDN%%.*}" | |
export KUBECONFIG="/tmp/kubeconfig-${CLUSTER_NAME}.conf" | |
set -euxo pipefail | |
# az aks get-versions --location=westeurope | jq | |
if ! az aks list --query '[].name' | grep -q "${CLUSTER_NAME}" ; then | |
az group create -n "${CLUSTER_NAME}" -l "${AZURE_LOCATION}" | |
az aks create \ | |
--auto-upgrade-channel stable \ | |
--enable-cluster-autoscaler \ | |
--kubernetes-version 1.26.0 \ | |
--max-count 5 \ | |
--min-count 2 \ | |
--name "${CLUSTER_NAME}" \ | |
--network-plugin none \ | |
--node-count 2 \ | |
--node-osdisk-size 30 \ | |
--node-vm-size Standard_B2ms \ | |
--nodepool-name "${CLUSTER_NAME}" \ | |
--nodepool-tags "Owner=petr.ruzicka@gmail.com" "Environment=dev" "Cluster_FQDN=${CLUSTER_FQDN}" \ | |
--resource-group "${CLUSTER_NAME}" \ | |
--tags "Owner=petr.ruzicka@gmail.com" "Environment=dev" "Cluster_FQDN=${CLUSTER_FQDN}" | |
az aks get-credentials --resource-group "${CLUSTER_NAME}" --name "${CLUSTER_NAME}" --admin --file "${KUBECONFIG}" --overwrite-existing | |
cilium install --helm-set cluster.name="${CLUSTER_NAME}" --azure-resource-group "${CLUSTER_NAME}" | |
else | |
az aks get-credentials --resource-group "${CLUSTER_NAME}" --name "${CLUSTER_NAME}" --admin --file "${KUBECONFIG}" --overwrite-existing | |
fi | |
cat << EOF | |
*** Cluster DELETE | |
export CLUSTER_FQDN="ruzickap1aks.k8s.mylabs.dev" | |
az group delete --resource-group "${CLUSTER_FQDN%%.*}" --yes | |
EOF | |
echo -e "\n*****\n export KUBECONFIG=${KUBECONFIG} \n*****\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment