az-aks
Manage Azure Kubernetes Service (AKS) clusters
TLDR
List AKS clusters
Create a new AKS cluster
Delete an AKS cluster
Get the access credentials for an AKS cluster
Get the upgrade versions available for an AKS cluster
SYNOPSIS
az aks subcommand [options]
This command group requires a specific subcommand to perform an action. Common subcommands and their basic syntax include:
az aks create --resource-group RESOURCE_GROUP_NAME --name CLUSTER_NAME --node-count NODE_COUNT
az aks list [--resource-group RESOURCE_GROUP_NAME]
az aks show --resource-group RESOURCE_GROUP_NAME --name CLUSTER_NAME
az aks get-credentials --resource-group RESOURCE_GROUP_NAME --name CLUSTER_NAME
az aks delete --resource-group RESOURCE_GROUP_NAME --name CLUSTER_NAME [--yes]
PARAMETERS
--resource-group RESOURCE_GROUP_NAME
Specifies the name of the Azure resource group containing the AKS cluster. Required for most operations that target an existing cluster.
--name CLUSTER_NAME
The name of the AKS cluster. Required for operations targeting a specific cluster, or for creating a new one.
--node-count COUNT
The number of nodes in the default node pool when creating a new cluster.
--generate-ssh-keys
Automatically generates SSH public and private key files if not specified for cluster creation, used for SSH access to nodes.
--kubernetes-version VERSION
The Kubernetes version to use for the cluster (e.g., '1.27.7') or to upgrade an existing cluster to.
--location LOCATION
The Azure region where the cluster will be created (e.g., 'eastus', 'westeurope').
--yes
Do not prompt for confirmation during destructive operations like `delete`.
--file FILE_PATH
The path to the file where cluster credentials should be saved (e.g., for `get-credentials`).
--output FORMAT
Output format for the command (e.g., 'json', 'jsonc', 'table', 'tsv'). Defaults to 'json'.
--help
Shows help message for a command or subcommand, detailing available options and usage examples.
DESCRIPTION
az aks is a command group within the Azure Command-Line Interface (Azure CLI) that provides a comprehensive set of tools for managing Azure Kubernetes Service (AKS) clusters. AKS is a managed Kubernetes service that simplifies the deployment, management, and operations of Kubernetes. This command group allows users to perform various operations directly from their terminal, such as creating new AKS clusters, listing existing ones, retrieving cluster credentials, upgrading Kubernetes versions, managing node pools, and deleting clusters.
It serves as a programmatic interface to interact with the Azure control plane for AKS resources, making it essential for automation, scripting, and efficient cloud resource management. Users can integrate az aks commands into scripts to automate complex deployment pipelines, manage infrastructure as code, and respond dynamically to changes in their cloud environment.
CAVEATS
- Dependency on Azure CLI: The az aks command group requires the Azure CLI to be installed and configured on your system.
- Authentication: You must be logged into an Azure account (`az login`) with sufficient Role-Based Access Control (RBAC) permissions to manage AKS resources within your subscription.
- Network Connectivity: Stable internet connectivity is required to interact with Azure services and manage AKS clusters.
- Cost Implications: Creating and running AKS clusters incurs costs on your Azure subscription, so ensure you manage and delete resources when no longer needed to avoid unexpected charges.
- Versioning: The behavior and available options of az aks commands can change with updates to the Azure CLI and Azure Kubernetes Service APIs. It's recommended to keep your Azure CLI up-to-date.
COMMAND GROUP STRUCTURE
The az aks command is part of a hierarchical structure within the Azure CLI. az is the root command, `aks` is a command group (similar to `az vm` for virtual machines or `az storage` for storage accounts), and further subcommands (e.g., `create`, `list`, `delete`, `upgrade`) are nested within it. This well-organized structure helps in managing the vast number of Azure services and their associated operations efficiently.
INTERACTIVE MODE
Azure CLI supports an interactive mode, invoked by running `az interactive`. This mode provides features like command completion, command descriptions, and examples, making it significantly easier to discover and correctly use az aks commands, especially for users new to the CLI or to specific AKS operations.
INFRASTRUCTURE AS CODE (IAC)
While az aks commands are excellent for scripting, automation, and quick operations, for production deployments and robust Infrastructure as Code (IaC) practices, they are often used in conjunction with Azure Resource Manager (ARM) templates, Bicep, or Terraform. These tools allow for declarative definition and deployment of AKS clusters and their surrounding infrastructure, ensuring consistency and repeatability.
HISTORY
The az aks command group's development is intricately linked with the rapid evolution of cloud computing, containerization, and microservices architectures. As Kubernetes gained widespread adoption as the de-facto standard for container orchestration, cloud providers like Microsoft Azure introduced managed Kubernetes services (AKS) to simplify its deployment and operation.
The Azure CLI, which began its life as `azure-cli` and later evolved into `az`, was developed to provide a consistent, powerful, and scriptable interface for managing Azure resources. The `aks` command group was specifically added and continuously enhanced within the Azure CLI to keep pace with new AKS features, Kubernetes versions, and evolving best practices. This evolution reflects the growing industry demand for automated, scalable, and resilient container deployment and management in the cloud.