| name | kubectl-cli |
| description | Kubernetes CLI operations for AKS cluster management. USE FOR: kubectl get, kubectl apply, kubectl describe, pod troubleshooting, service debugging, namespace management. DO NOT USE FOR: Helm charts (use helm-cli), ArgoCD sync (use argocd-cli), Azure resource provisioning (use azure-cli). |
When to Use
- Cluster health verification
- Resource deployment and management
- Troubleshooting pod issues
- Viewing logs and events
Prerequisites
- kubectl installed and configured
- KUBECONFIG set to valid config
- kubelogin for Azure AD authentication
- Appropriate RBAC permissions
Commands
Cluster Health
kubectl cluster-info
kubectl get nodes -o wide
kubectl get pods -n kube-system
kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded
Resource Management
kubectl apply -f manifest.yaml --dry-run=client -o yaml
kubectl diff -f manifest.yaml
kubectl apply -f manifest.yaml --record
kubectl delete -f manifest.yaml --grace-period=30
Troubleshooting
kubectl describe pod <pod-name> -n <namespace>
kubectl logs -f <pod-name> -n <namespace>
kubectl logs <pod-name> -n <namespace> --previous
kubectl get events -n <namespace> --sort-by='.lastTimestamp'
kubectl exec -it <pod-name> -n <namespace> -- /bin/sh
Resource Queries
kubectl get all -n <namespace> -o wide
kubectl get deployment <name> -n <namespace> -o yaml
kubectl top pods -n <namespace>
kubectl top nodes
Best Practices
- ALWAYS use --dry-run=client before apply
- ALWAYS specify namespace with -n
- Use labels for selection: -l app=myapp
- Check events when pods fail
- Use kubectl diff for change preview
- NEVER delete without explicit namespace
Output Format
- Command executed
- Resource status summary
- Any warnings or errors
- Recommended actions
Integration with Agents
Used by: @deploy, @backstage-expert, @sre