using bash (Azure Cloud Shell)
export RESOURCE_GROUP=rg-contoso-video
export CLUSTER_NAME=aks-contoso-video
export LOCATION=canadaeast
Create Resource Group
az group create --name=$RESOURCE_GROUP --location=$LOCATION
Example Output:
{
"id": "/subscriptions/5e6a8cc2-0f92-4949-8218-cfdb9092ba32/resourceGroups/rg-contoso-video",
"location": "canadaeast",
"managedBy": null,
"name": "rg-contoso-video",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
Create the AKS cluster
az aks create \
--resource-group $RESOURCE_GROUP \
--name $CLUSTER_NAME \
--node-count 2 \
--generate-ssh-keys \
--node-vm-size Standard_B2s \
--network-plugin azure
Add another node pool (linux)
az aks nodepool add --resource-group $RESOURCE_GROUP --cluster-name $CLUSTER_NAME --name userpool --node-count 2 --node-vm-size Standard_B2s
Link with kubectl
az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP
This command adds an entry to your ~/.kube/config file, which holds all the information to access your clusters. Kubectl enables you to manage multiple clusters from a single command-line interface.
kubectl get nodes
example output:
NAME STATUS ROLES AGE VERSION
aks-nodepool1-39269080-vmss000000 Ready agent 36m v1.28.9
aks-nodepool1-39269080-vmss000001 Ready agent 36m v1.28.9
aks-userpool-40567055-vmss000000 Ready agent 2m7s v1.28.9
aks-userpool-40567055-vmss000001 Ready agent 2m8s v1.28.9