az login
az account set -s <subscription-id>
export RESOURCE_GROUP="akshandsonlab"
export LOCATION="koreacentral"
export AKS_CLUSTER_NAME="sanseaks"
export ACR_NAME="sanseAcr"
export SQL_SERVER_NAME="sansedb"
# Create Resource Group
az group create --name $RESOURCE_GROUP --location $LOCATION
# Useful AKS version in Location
version=$(az aks get-versions -l $LOCATION --query 'orchestrators[-1].orchestratorVersion' -o tsv)
# Crate AKS
az aks create --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --enable-addons monitoring --kubernetes-version "1.14.8" --generate-ssh-keys --location $LOCATION
# Create ACR
az acr create --resource-group $RESOURCE_GROUP --name $ACR_NAME --sku Standard --location $LOCATION
# Get the id of the service principal configured for AKS
CLIENT_ID=$(az aks show --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv)
# Get the ACR registry resource id
ACR_ID=$(az acr show --name $ACR_NAME --resource-group $RESOURCE_GROUP --query "id" --output tsv)
# Create role assignment
az role assignment create --assignee $CLIENT_ID --role acrpull --scope $ACR_ID
# Create Sql Server
az sql server create -l $LOCATION -g $RESOURCE_GROUP -n $SQL_SERVER_NAME -u sqladmin -p P2ssw0rd1234
# Create Database
az sql db create -g $RESOURCE_GROUP -s $SQL_SERVER_NAME -n mhcdb --service-objective S0
# Aks credentials
az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME
# kubernetes pods
kubectl get pods
# Get Extenal IP
kubectl get service mhc-front --watch
# Create ClusterRole for kubernetes-dashboard
kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
# Run kubernetes-dashboard Browser
az aks browse --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME
# Proxy running on http://127.0.0.1:8001/
# Press CTRL+C to close the tunnel...