Created
July 10, 2019 18:17
-
-
Save dfar-io/f8c7a8b92c3c7cd86176e582f28fa2c5 to your computer and use it in GitHub Desktop.
Programmatically adds a AKS cluster to a Ubuntu box
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 | |
set -e | |
set -o pipefail | |
if [ "$1" == "" ] | |
then | |
echo "AKS RG is required." | |
exit 1 | |
fi | |
if [ "$2" == "" ] | |
then | |
echo "AKS Name is required." | |
exit 1 | |
fi | |
if [ "$3" == "" ] | |
then | |
echo "Subscription ID is required." | |
exit 1 | |
fi | |
if [ "$4" == "" ] | |
then | |
echo "Context name is required." | |
exit 1 | |
fi | |
echo Connecting to AKS... | |
az aks get-credentials -g $1 -n $2 --subscription $3 | |
echo Renaming cluster... | |
kubectl config set-context $4 --cluster $2 --user clusterUser_$1_$2 | |
kubectl config delete-context $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment