In this blog , There are couple of ways to host container workloads in Azure, Azure Kubernetes Service (AKS) provides the simplest way to deploy Kubernetes Cluster in Azure with full orchestration solution. There are following ways to create AKS Cluster in Azure .
- The Azure CLI
- The Azure portal
- Azure PowerShell
- Using template-driven deployment options, like Azure Resource Manager templates, Bicep and Terraform
In this Blog ,We will see how can we create AKS cluster using Azure portal and get details using CLI command.
Prerequisite : Azure Subscription
Step 1- Choose Create Resource ->Containers -> Azure Kubernetes Service
Step 2- Fill below details
- Basics
- Subscription: Free Trial
- Resource Group: Creat New: aks-demo-res1
- Cluster Details – Standard (For more details on preset configurations, see Note below)
- Kubernetes Cluster Name: demo1
- Region: Southeastasia
- Kubernetes Version: Select what ever is latest stable version
- Node Size: Standard DS2 v2 (Default one)
- Node Count: 1
- Node Pools
- leave to defaults
- Authentication
- Authentication method: System-assigned managed identity (Default)
- Rest all leave to defaults
- Networking
- Network Configuration: Azure CNI
- Network Policy: Azure
- Rest all leave to defaults
- Integrations
- Azure Container Registry: None
- leave to defaults
- Tags
- leave to defaults
- Review + Create
- Click on Create
Note – When you create a cluster using the Azure portal, you can choose a Cluster Details preset configuration to quickly customize based on your scenario. You can modify any of the preset values at any time.
Preset | Description |
Standard | Best if you’re not sure what to choose. Works well with most applications. |
Dev/Test | Best for experimenting with AKS or deploying a test application. |
Cost-optimized | Best for reducing costs on production workloads that can tolerate interruptions. |
Batch processing | Best for machine learning, compute-intensive, and graphics-intensive workloads. Suited for applications requiring fast scale-up and scale-out of the cluster. |
Hardened access | Best for large enterprises that need full control of security and stability. |
Step-2 Let’s connect to kubernetes cluster and verify
Go to https://shell.azure.com
# Template
az aks get-credentials --resource-group <Resource-Group-Name> --name <Cluster-Name>
# Replace Resource Group & Cluster Name
az aks get-credentials --resource-group aks-res --name demo1
# List Kubernetes Worker Nodes
kubectl get nodes
kubectl get nodes -o wide
Step-3 Get namespaces created by kubernetes cluster
# List Namespaces
kubectl get namespaces
kubectl get ns
# List Pods from all namespaces (List of workload in default namespace)
kubectl get pods --all-namespaces
# List all k8s objects from Cluster Control plane (Services,Objects,Namespaces)
kubectl get all --all-namespaces
Note – We can also verify enhanced networking is enabled or not from VM Scaleset. It’s important when we are dealing connection with external Azure Services. (eg when we are connecting with other services like mysql or sql . In this case until we don’t have enhanced networking enabled we can get node pool performance issue .) That’s why it’s recommended to use VM type which has enhanced networking enabled . So our performance when we are going to connect from AKS cluster to other Azure Services don’t affected.
Step-4 – Connect with local desktop cli command.
# Login to Azure
az login
# Install Azure AKS CLI
az aks install-cli
# Configure Cluster Creds (kube config)
az aks get-credentials --resource-group aks-res --name demo1
# List AKS Nodes
kubectl get nodes
kubectl get nodes -o wide