How to connect to node file systems within an [[Azure Kubernetes Service]] Cluster ## Prerequisites - Install [[Azure CLI]] - Install [[Chocolatety]] ## Install Tools 1. Installs command-line tool `kubectl` for interacting with Kubernetes clusters ```azurecli choco install kubernetes-cli ``` 2. Installs command-line tool to enable [[Microsoft Entra ID]] integration for `kubectl` to authenticate with AKS clusters. ```azurecli choco install azure-kubelogin ``` 3. The command `az aks install-cli` installs the Kubernetes command-line tool (`kubectl`) using the Azure CLI. ```azurecli az aks install-cli ``` ## Set Subscription Scope and Target AKS Cluster 1. Azure CLI command to set the active Azure subscription ```azurecli az account set --subscription "<subscription name>" ``` 2. Azure CLI command which configures `kubectl` to use the credentials of the specified AKS cluster, allowing you to interact with the cluster. ```azurecli az aks get-credentials --resource-group <aks rg name> --name <name of aks cluster> --format azure ``` ## KubeCTL 1. This allows `kubectl` to authenticate with the AKS cluster using Azure CLI credentials. ```azurecli kubelogin convert-kubeconfig -l azurecli ``` 2. List AKS nodes and pods ```azurecli kubectl get nodes kubectl get pods -A ``` ## Connect to a Windows Node This will log you into a PowerShell terminal within the Windows Node. ```azlurecli kubectl exec --stdin --tty "azdevopswindows-deployment-794494459-2bf58" -- pwsh ``` ## Connect to a Linux Node This will log you into a Bash terminal within the Linux Node. ```azurecli kubectl exec --stdin --tty "azdevopslinux-deployment-5fd78b8d85-wsl9w" -- /bin/bash ```