AKS Reference Documentation
Azure CLI Commands
This section details commonly used Azure CLI commands for managing AKS clusters. For the complete reference, consult the official Azure CLI documentation.
Cluster Management
# Create a new AKS cluster
az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 1 --enable-addons monitoring --generate-ssh-keys
# Get cluster credentials
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
# List AKS clusters in a subscription
az aks list --output table
# Show details of a specific AKS cluster
az aks show --resource-group myResourceGroup --name myAKSCluster
# Scale the node count of a cluster
az aks scale --resource-group myResourceGroup --name myAKSCluster --node-count 3
# Upgrade a cluster's Kubernetes version
az aks upgrade --resource-group myResourceGroup --name myAKSCluster --kubernetes-version <new-version>
# Delete an AKS cluster
az aks delete --resource-group myResourceGroup --name myAKSCluster
Node Pool Management
# Add a new node pool
az aks nodepool add --resource-group myResourceGroup --cluster-name myAKSCluster --name nodepool2 --node-count 3 --mode User
# List node pools in a cluster
az aks nodepool list --resource-group myResourceGroup --cluster-name myAKSCluster --output table
# Scale a specific node pool
az aks nodepool scale --resource-group myResourceGroup --cluster-name myAKSCluster --name nodepool2 --node-count 5
# Delete a node pool
az aks nodepool delete --resource-group myResourceGroup --cluster-name myAKSCluster --name nodepool2
Kubernetes API Reference
AKS is built on Kubernetes. For detailed specifications on Kubernetes API objects such as Pods, Deployments, Services, and more, refer to the official Kubernetes API reference documentation.
Understanding the Kubernetes API is crucial for advanced configuration and automation.
Key API Resources
- Pods: The smallest deployable units in Kubernetes.
- Deployments: Manages stateless applications, providing declarative updates.
- StatefulSets: Manages stateful applications, providing stable network identifiers and persistent storage.
- Services: Defines a logical set of Pods and a policy by which to access them.
- Ingress: Manages external access to services in a cluster, typically HTTP.
- ConfigMaps & Secrets: For managing configuration data and sensitive information.
AKS Configuration Parameters
When creating or updating AKS clusters, various parameters can be configured. Here are some of the most significant ones:
Cluster Creation Parameters (`az aks create`)
Parameter | Description | Type | Required |
---|---|---|---|
--resource-group |
Name of the resource group. | String | Yes |
--name |
Name of the AKS cluster. | String | Yes |
--node-count |
Number of nodes in the default node pool. | Integer | No (defaults to 3) |
--kubernetes-version |
Kubernetes version to use for the cluster. | String | No (defaults to the latest supported stable version) |
--enable-addons |
Comma-separated list of add-ons to enable (e.g., monitoring, http_application_routing). | String | No |
--network-plugin |
Network plugin to use (e.g., azure, kubenet). | String | No (defaults to azure) |
--network-policy |
Network policy to use (e.g., azure, calico). | String | No |
--enable-managed-identity |
Use managed identity for the cluster. | Boolean | No (defaults to false) |
--location |
Azure region where the cluster will be deployed. | String | No (defaults to resource group location) |
Node Pool Configuration
Node pools can be configured with specific VM sizes, counts, and other properties. See the `az aks nodepool add` command for details.
Networking Options
- Network Plugin:
azure
(Azure CNI) orkubenet
. Azure CNI offers better performance and more granular control but requires more IP addresses. - Network Policy: Control traffic flow between pods using
azure
(Azure Network Policy) orcalico
.
Common Error Codes & Solutions
Encountering issues is part of managing any complex system. Here are some common error scenarios and potential resolutions:
- Verify the image name and tag are correct.
- Ensure the container registry is accessible from the AKS nodes.
- Check for correct authentication credentials if the registry is private.
- Check the container logs using
kubectl logs <pod-name>
. - Ensure the application is configured correctly and not exiting with an error code.
- Check resource limits (CPU/memory) if the application is crashing due to resource exhaustion.
- Ensure CoreDNS is running correctly.
- Validate custom DNS configurations if applicable.
- Check Network Policies that might be blocking DNS traffic.