Let's perform the following steps:
- Log in to your account:
$ az login
- Create a resource group named k8sdevopscookbook in your preferred region:
$ az group create --name k8sdevopscookbook --location eastus
- Create a service principal and take note of your appId and password for the next steps:
$ az ad sp create-for-rbac --skip-assignment
{
"appId": "12345678-1234-1234-1234-123456789012",
"displayName": "azure-cli-2019-05-11-20-43-47",
"name": "http://azure-cli-2019-05-11-20-43-47",
"password": "12345678-1234-1234-1234-123456789012",
"tenant": "12345678-1234-1234-1234-123456789012"
- Create a cluster. Replace appId and password with the output from the preceding command:
$ az aks create --resource-group k8sdevopscookbook \
--name AKSCluster \
--kubernetes-version 1.15.4 \
--node-vm-size Standard_DS2_v2 \
--node-count 3 \
--service-principal <appId> \
--client-secret <password> \
--generate-ssh-keys
Cluster creation will take around 5 minutes. You will see "provisioningState": Succeeded" when it has successfully completed.