Skip to content

Instantly share code, notes, and snippets.

@ljtill
Created January 31, 2024 11:16
Show Gist options
  • Save ljtill/4024925d35367672bc9cd4cff7a16c04 to your computer and use it in GitHub Desktop.
Save ljtill/4024925d35367672bc9cd4cff7a16c04 to your computer and use it in GitHub Desktop.
Provides the ability to deploy Kubernetes Service with Application Gateway Ingress Controller
#!/usr/bin/env bash
set -e
#
# Variables
#
RESOURCE_GROUP=''
LOCATION=''
NAME=''
#
# Resource Group
#
echo -e "\e[1;34mCreating resource group $RESOURCE_GROUP in location $LOCATION\e[0m"
az group create \
--name $RESOURCE_GROUP \
--location $LOCATION
#
# Kubernetes Service
#
echo -e "\e[1;34mCreating cluster $NAME in resource group $RESOURCE_GROUP\e[0m"
az aks create --name $NAME \
--resource-group $RESOURCE_GROUP \
--network-plugin azure \
--enable-managed-identity \
--enable-addons ingress-appgw \
--appgw-name $NAME \
--appgw-subnet-cidr "10.225.0.0/16" \
--no-ssh-key
echo -e "\e[1;34mWaiting 30 seconds to allow for resource graph updates...\e[0m"
sleep 30
echo -e "\e[1;34mRetrieving AKS credentials\e[0m"
az aks get-credentials \
-n $NAME \
-g $RESOURCE_GROUP \
--overwrite-existing
#
# Application
#
kubectl apply -f https://raw.githubusercontent.com/Azure/application-gateway-kubernetes-ingress/master/docs/examples/aspnetapp.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment