Kubernetes has become the standard platform for deploying and managing containerized applications. When running workloads in Azure Kubernetes Service (AKS), one of the most common operational tasks is checking the health and status of application pods.
This guide walks through the process of connecting to an AKS cluster using Azure CLI and Kubernetes CLI (kubectl), and then verifying that application pods are running successfully.
Prerequisites
Before getting started, ensure you have:
- Azure CLI installed
- Kubernetes CLI (kubectl) installed
- Access to the Azure subscription hosting the AKS cluster
- Appropriate permissions to access the AKS cluster
Step 1: Log in to Azure
Start by authenticating with Azure using the Azure CLI:
az login
After successful authentication, Azure displays the list of available subscriptions associated with your account.
Example:
[2] xyz-kubility-prod
[3] xyz-kubility-test
[4] Production-Infrastructure
[5] UAT-Infrastructure
Select the subscription that contains your AKS cluster.
Step 2: Set the Azure Subscription
If multiple subscriptions are available, explicitly set the target subscription:
az account set --subscription <subscription-id>
Example:
az account set --subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx
This ensures all subsequent Azure CLI commands target the correct environment.
Step 3: Connect to the AKS Cluster
Retrieve the Kubernetes credentials for the AKS cluster:
--resource-group XYZ-ABC-DEFGHIG-PROD-RG \
--name ABCXYZDEFAKS \
--overwrite-existing
Successful execution returns a message similar to:
Merged "ABCXYZDEFAKS" as current context in C:\Users\UserOne\.kube\config
This command updates your local kubeconfig file and sets the AKS cluster as the current Kubernetes context.
Step 4: Verify Cluster Connectivity
Run the following command:
kubectl get pods
You may see:
No resources found in default namespace.
This is normal if your applications are deployed in a namespace other than the default namespace.
Step 5: Check Pods in the Application Namespace
List pods within the target namespace:
kubectl get pods -n sasefbprod
Understanding the Output
The command output provides several useful indicators:
| Column | Description |
|---|---|
| NAME | Unique pod name generated by Kubernetes |
| READY | Number of containers running versus expected containers |
| STATUS | Current pod state (Running, Pending, CrashLoopBackOff, etc.) |
| RESTARTS | Number of times the container has restarted |
| AGE | How long the pod has been running |
In the example above:
- All pods show 1/1 READY, indicating all containers are healthy.
- The STATUS is Running for every pod.
- The RESTARTS count is 0, which indicates no unexpected container restarts.
- Pod ages vary based on deployment timelines.
Useful Troubleshooting Commands
View All Namespaces
View Pods Across All Namespaces
kubectl get pods --all-namespaces
Describe a Pod
kubectl describe pod <pod-name> -n sasefbprod
View Pod Logs
kubectl logs <pod-name> -n sasefbprod
Check Deployment Status
kubectl get deployments -n sasefbprod
Conclusion
Monitoring pod status is one of the most important day-to-day tasks for Kubernetes administrators and DevOps engineers. By logging into Azure, connecting to the AKS cluster, and using kubectl commands, you can quickly verify application health and identify potential issues before they impact users.
A healthy pod status typically shows:
- READY = Expected container count
- STATUS = Running
- RESTARTS = 0 or minimal
- No error events in pod descriptions
Regularly checking pod health helps ensure your AKS-hosted applications remain stable, available, and performant.










.gif)
0 Comments