Azure kubectl CLI
Use this skill to turn Kubernetes operations requests into ordered kubectl workflows, verify context and namespace safety, and return resource status, log, event, diff, apply, or troubleshooting evidence.
When to invoke
- "Check cluster health or node status with kubectl."
- "Apply, diff, or inspect Kubernetes manifests."
- "Troubleshoot pods with describe, logs, events, or exec."
- "Inspect services, deployments, namespaces, or resource usage."
- "Validate network policy or secret references by name."
Prerequisites and context
- kubectl installed and configured.
- KUBECONFIG set to valid config.
- kubelogin for Azure AD authentication.
- Appropriate RBAC permissions.
Procedure
- Confirm the Kubernetes context and namespace before resource operations.
- Use dry-run or diff before applying manifests when changes are in scope.
- Run the narrowest cluster health, resource management, troubleshooting, or query command that satisfies the request.
- Capture status, warning, error, log, event, or usage evidence.
- Return the result using the output template.
Cluster health
# Cluster info
kubectl cluster-info
# Node status
kubectl get nodes -o wide
# System pods
kubectl get pods -n kube-system
# Unhealthy pods across all namespaces
kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded
Resource management
# Dry-run before apply
kubectl apply -f manifest.yaml --dry-run=client -o yaml
# Diff changes
kubectl diff -f manifest.yaml
# Apply with recording
kubectl apply -f manifest.yaml --record
# Delete with grace
kubectl delete -f manifest.yaml --grace-period=30
Troubleshooting
# Describe pod
kubectl describe pod <pod-name> -n <namespace>
# Pod logs (current)
kubectl logs -f <pod-name> -n <namespace>
# Pod logs (previous crash)
kubectl logs <pod-name> -n <namespace> --previous
# Events by time
kubectl get events -n <namespace> --sort-by='.lastTimestamp'
# Exec into pod
kubectl exec -it <pod-name> -n <namespace> -- /bin/sh
Resource queries
# Get all resources in namespace
kubectl get all -n <namespace> -o wide
# Get resource as YAML
kubectl get deployment <name> -n <namespace> -o yaml
# Resource usage
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 template
Return exactly this structure:
**Status:** PASS | FAIL | BLOCKED
**Summary:** One sentence describing the Kubernetes health, apply, diff, log, event, query, or troubleshooting outcome.
### Details
1. Command executed: `<kubectl command>`
2. Context and namespace: `<current context and namespace>`
3. Resource status summary: `<pods, nodes, deployment, service, event, or manifest status>`
4. Warnings or errors: `<kubectl warnings, RBAC errors, unhealthy resources, or none>`
5. Recommended actions: `<next kubectl action or none>`
### Validation
- Change preview: `<dry-run, diff, or reason not checked>`
- Command result: `<exit code or observed kubectl output>`
Limits
- Do not use this skill for Helm chart management.
- Use
helm-cli (skill) instead when the task is chart repositories, values, template rendering, release upgrades, or rollbacks.
- Do not use this skill for ArgoCD GitOps sync.
- Use
argocd-cli (skill) instead when the task is GitOps app sync, health, diff, drift, or repository credential workflows.
- Do not use this skill for Azure resource provisioning.
- Use
azure-cli (skill) or terraform-cli (skill) instead when the task is Azure resource provisioning, resource group management, or infrastructure state.
- Do not use this skill for full deployment orchestration.
- Use
deploy-orchestration (skill) instead when the task spans prerequisites, Terraform, Kubernetes verification, and platform rollout sequencing.
Related primitives
| Name |
Type |
Use it when |
open-horizons-deployment-operator |
agent |
Coordinating approved Kubernetes operations as part of an end-to-end deployment. |
backstage-expert |
agent |
Validating Backstage workloads and portal runtime behavior on Kubernetes. |
open-horizons-sre-investigator |
agent |
Troubleshooting pods, services, events, or resource saturation. |
helm-cli |
skill |
Managing Helm releases that create Kubernetes resources. |
argocd-cli |
skill |
Managing GitOps applications that own Kubernetes resources. |
azure-cli |
skill |
Acquiring AKS credentials before kubectl operations. |
Quality gate
1---2name: azure-kubectl-cli-33description: kubectl CLI operations inspect and manage AKS and Kubernetes resources directly, including health checks, manifests, rollout status, logs, events, namespaces, pod troubleshooting, service debugging, secrets inspection by name, and network policy validation. Use this skill when working with kubectl get, describe, logs, apply, diff, exec, top, or rollout workflows.4---56<!-- Generated from harness/github-copilot/plugins/open-horizons-platform/skills/azure-kubectl-cli/SKILL.md by harness/claude-code/scripts/convert_from_copilot.py. Edit the source, not this file. -->78# Azure kubectl CLI910Use this skill to turn Kubernetes operations requests into ordered `kubectl` workflows, verify context and namespace safety, and return resource status, log, event, diff, apply, or troubleshooting evidence.1112## When to invoke1314- "Check cluster health or node status with kubectl."15- "Apply, diff, or inspect Kubernetes manifests."16- "Troubleshoot pods with describe, logs, events, or exec."17- "Inspect services, deployments, namespaces, or resource usage."18- "Validate network policy or secret references by name."1920## Prerequisites and context2122- kubectl installed and configured.23- KUBECONFIG set to valid config.24- kubelogin for Azure AD authentication.25- Appropriate RBAC permissions.2627## Procedure28291. Confirm the Kubernetes context and namespace before resource operations.302. Use dry-run or diff before applying manifests when changes are in scope.313. Run the narrowest cluster health, resource management, troubleshooting, or query command that satisfies the request.324. Capture status, warning, error, log, event, or usage evidence.335. Return the result using the output template.3435### Cluster health3637```bash38# Cluster info39kubectl cluster-info4041# Node status42kubectl get nodes -o wide4344# System pods45kubectl get pods -n kube-system4647# Unhealthy pods across all namespaces48kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded49```5051### Resource management5253```bash54# Dry-run before apply55kubectl apply -f manifest.yaml --dry-run=client -o yaml5657# Diff changes58kubectl diff -f manifest.yaml5960# Apply with recording61kubectl apply -f manifest.yaml --record6263# Delete with grace64kubectl delete -f manifest.yaml --grace-period=3065```6667### Troubleshooting6869```bash70# Describe pod71kubectl describe pod <pod-name> -n <namespace>7273# Pod logs (current)74kubectl logs -f <pod-name> -n <namespace>7576# Pod logs (previous crash)77kubectl logs <pod-name> -n <namespace> --previous7879# Events by time80kubectl get events -n <namespace> --sort-by='.lastTimestamp'8182# Exec into pod83kubectl exec -it <pod-name> -n <namespace> -- /bin/sh84```8586### Resource queries8788```bash89# Get all resources in namespace90kubectl get all -n <namespace> -o wide9192# Get resource as YAML93kubectl get deployment <name> -n <namespace> -o yaml9495# Resource usage96kubectl top pods -n <namespace>97kubectl top nodes98```99100### Best practices1011021. ALWAYS use --dry-run=client before apply.1032. ALWAYS specify namespace with -n.1043. Use labels for selection: -l app=myapp.1054. Check events when pods fail.1065. Use kubectl diff for change preview.1076. NEVER delete without explicit namespace.108109## Output template110111Return exactly this structure:112113```markdown114**Status:** PASS | FAIL | BLOCKED115**Summary:** One sentence describing the Kubernetes health, apply, diff, log, event, query, or troubleshooting outcome.116117### Details1181. Command executed: `<kubectl command>`1192. Context and namespace: `<current context and namespace>`1203. Resource status summary: `<pods, nodes, deployment, service, event, or manifest status>`1214. Warnings or errors: `<kubectl warnings, RBAC errors, unhealthy resources, or none>`1225. Recommended actions: `<next kubectl action or none>`123124### Validation125- Change preview: `<dry-run, diff, or reason not checked>`126- Command result: `<exit code or observed kubectl output>`127```128129## Limits130131- Do not use this skill for Helm chart management.132- Use `helm-cli` (`skill`) instead when the task is chart repositories, values, template rendering, release upgrades, or rollbacks.133- Do not use this skill for ArgoCD GitOps sync.134- Use `argocd-cli` (`skill`) instead when the task is GitOps app sync, health, diff, drift, or repository credential workflows.135- Do not use this skill for Azure resource provisioning.136- Use `azure-cli` (`skill`) or `terraform-cli` (`skill`) instead when the task is Azure resource provisioning, resource group management, or infrastructure state.137- Do not use this skill for full deployment orchestration.138- Use `deploy-orchestration` (`skill`) instead when the task spans prerequisites, Terraform, Kubernetes verification, and platform rollout sequencing.139140## Related primitives141142| Name | Type | Use it when |143| --- | --- | --- |144| `open-horizons-deployment-operator` | `agent` | Coordinating approved Kubernetes operations as part of an end-to-end deployment. |145| `backstage-expert` | `agent` | Validating Backstage workloads and portal runtime behavior on Kubernetes. |146| `open-horizons-sre-investigator` | `agent` | Troubleshooting pods, services, events, or resource saturation. |147| `helm-cli` | `skill` | Managing Helm releases that create Kubernetes resources. |148| `argocd-cli` | `skill` | Managing GitOps applications that own Kubernetes resources. |149| `azure-cli` | `skill` | Acquiring AKS credentials before kubectl operations. |150151## Quality gate152153- [ ] `name` is `kubectl-cli` and matches the parent directory.154- [ ] Context and namespace are confirmed or explicitly reported as unknown.155- [ ] `--dry-run=client` or `kubectl diff` is used before apply when manifest changes are in scope.156- [ ] Delete operations include an explicit namespace and grace period when applicable.157- [ ] Troubleshooting responses include describe, logs, events, or resource status evidence as appropriate.158- [ ] Secret handling is limited to names unless a safe explicit value retrieval is required.