Last active
March 1, 2023 17:46
-
-
Save ljtill/1729c81af237c1d0a5c1720d6d81abc4 to your computer and use it in GitHub Desktop.
Provides the ability to create / delete multiple Kubernetes clusters
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
#!/bin/bash | |
configuration=$(cat ./resources.json) | |
length=$(echo $configuration | jq -r ".clusters | length") | |
for ((i=0; i<length; i++)); do | |
read name location country <<< $(echo $configuration | jq -r ".clusters[$i] | [.name, .location, .country] | @tsv") | |
echo "=> Creating Kubernetes cluster ($country)..." | |
az aks create \ | |
--resource-group "Management" \ | |
--name $name \ | |
--location $location \ | |
--min-count "3"\ | |
--max-count "175" \ | |
--enable-cluster-autoscaler \ | |
--node-vm-size "standard_d8s_v5" \ | |
--zones "3" \ | |
--generate-ssh-keys \ | |
--auto-upgrade-channel patch \ | |
--no-wait | |
done |
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
#!/bin/bash | |
configuration=$(cat ./resources.json) | |
length=$(echo $configuration | jq -r ".clusters | length") | |
for ((i=0; i<length; i++)); do | |
read name country <<< $(echo $configuration | jq -r ".clusters[$i] | [.name, .country] | @tsv") | |
echo "=> Deleting Kubernetes cluster ($country)..." | |
az aks delete \ | |
--resource-group "Management" \ | |
--name $name \ | |
--yes \ | |
--no-wait | |
done |
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
{ | |
"clusters": [ | |
{ | |
"name": "", | |
"location": "swedencentral", | |
"country": "Sweden" | |
}, | |
{ | |
"name": "", | |
"location": "francecentral", | |
"country": "France" | |
}, | |
{ | |
"name": "", | |
"location": "germanywestcentral", | |
"country": "Germany" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment