You can get the list of AKS cluster names and node pool names using the PowerShell script below.
# Get the list of AKS clusters
$aksClusters = Get-AzAksCluster
# Loop through each AKS cluster and get the node pool and node names
foreach ($aksCluster in $aksClusters) {
$aksClusterName = $aksCluster.Name
$aksResourceGroup = $aksCluster.ResourceGroupName
write-output "AKS Clusters: $aksClusterName"
$aksNodepool = Get-AzAksNodepool -ResourceGroupName $aksResourceGroup -ClusterName $aksClusterName
foreach ( $item in $aksNodepool)
{
Write-Output "AKS NodePools: $item. Name"
}
}
For the node names list you need to use the Kubectl commands:
kubectl get nodes -l "type=virtual-node,node-role.kubernetes.io/agentpool=<node-pool-name>"
The AKS node names are not included in the node pool properties because node names are assigned by the Kubernetes and are not related to the node pool. When you create an AKS cluster, Kubernetes creates a set of nodes to run your workloads. These nodes are created in a node pool, which is a logical grouping of nodes with similar configurations. However, the node names are assigned by Kubernetes and are not related to the node pool.
You can use the kubectl get nodes
command to get the list of nodes in your AKS cluster, and the kubectl describe node <node-name>
command to get detailed information about a specific node, including its name. However, the node names are not included in the node pool properties because they are not related to the node pool.
If this does answer your question, please accept it as the answer as a token of appreciation.