| name | kubernetes |
| description | Comprehensive Kubernetes cluster management skill. Use this skill when working with Kubernetes resources, kubectl operations, Helm charts, container orchestration, debugging pods, managing deployments, or any Kubernetes-related infrastructure tasks. |
| allowed-tools | Bash(kubectl:*), Bash(helm:*), Bash(kustomize:*) |
Kubernetes Management Skill
This skill provides comprehensive capabilities for managing Kubernetes clusters, resources, and workloads using kubectl, Helm, and Kustomize.
When to Use This Skill
Use this skill when working with:
- Kubernetes resources (pods, deployments, services, configmaps, secrets, etc.)
- Debugging containerized applications and troubleshooting cluster issues
- Helm chart installation, upgrades, and management
- kubectl operations (get, describe, apply, create, delete, logs, exec, scale, rollout)
- Context and namespace management
- Deployment strategies (rolling updates, blue-green, canary)
- Configuration management and resource optimization
How to Use This Skill
1. Verify Context and Namespace
Always start by verifying your current context and namespace:
kubectl config current-context
kubectl config view --minify
Set namespace if needed:
kubectl config set-context --current --namespace=<namespace>
2. Load Appropriate Reference Files
Based on the task at hand, load the relevant reference documentation:
For kubectl Operations: Load kubectl Reference when you need detailed information about:
- Getting, describing, creating, updating, or deleting resources
- Viewing logs or executing commands in containers
- Port forwarding and debugging
- Scaling deployments
- Managing rollouts and rollbacks
- Context and namespace operations
- Output formats and filtering
For Helm Operations: Load Helm Reference when you need detailed information about:
- Installing or upgrading Helm charts
- Managing releases (list, status, uninstall, rollback)
- Repository management
- Chart development and inspection
- Values configuration and overrides
- Troubleshooting Helm issues
For Common Workflows: Load Workflows Reference when you need guidance on:
- Debugging failing pods or services
- Deploying applications
- Updating deployments with different strategies
- Blue-green and canary deployments
- Configuration management (ConfigMaps and Secrets)
- Maintenance operations (draining nodes, backup/restore)
- Cluster inspection and cleanup
For Best Practices: Load Best Practices Reference when you need guidance on:
- Safety and validation before operations
- Efficiency and optimization
- Debugging approaches
- YAML and manifest management
- High availability patterns
- Error handling and troubleshooting
- Integration with other tools
- Environment-specific practices
3. General Workflow
For Resource Management:
- Verify context and namespace
- Use
kubectl getto list resources - Use
kubectl describefor detailed information - Apply changes with
kubectl applyorkubectl patch - Monitor with
kubectl rollout statusorkubectl get events
For Debugging:
- Check pod status with
kubectl get pods - Describe the resource with
kubectl describe - View logs with
kubectl logs - Check events with
kubectl get events - Exec into container if needed with
kubectl exec -it
For Deployments:
- Validate manifests with
--dry-run - Apply manifests with
kubectl apply - Monitor rollout with
kubectl rollout status - Verify with
kubectl getandkubectl logs - Rollback if needed with
kubectl rollout undo
Key Principles
Safety First
- Always verify context and namespace before operations
- Use
--dry-run=clientor--dry-run=serverto validate changes - Use
kubectl diffto preview changes before applying - Be cautious with destructive operations (delete, force, drain)
Declarative Over Imperative
- Prefer
kubectl apply -f file.yamlover imperative commands - Store manifests in version control
- Use Kustomize for environment-specific overlays
- Make infrastructure reproducible and auditable
Efficient Resource Usage
- Use label selectors to operate on groups of resources
- Use output formats (
-o json|yaml) for automation and parsing - Filter with
--field-selectorand sort with--sort-by - Watch resources in real-time with
-wflag
Systematic Debugging
- Follow the debugging workflow: status → describe → logs → events → exec
- Use timestamps in logs for correlation
- Check recent events with
kubectl get events --sort-by='.lastTimestamp' - Test connectivity with temporary debug pods
Quick Command Reference
Most Common Operations:
# Get resources
kubectl get pods
kubectl get pods -o wide
kubectl get pods -l app=myapp
# Describe for details
kubectl describe pod <pod-name>
# View logs
kubectl logs <pod-name>
kubectl logs <pod-name> -f
kubectl logs <pod-name> --previous
# Exec into pod
kubectl exec -it <pod-name> -- /bin/sh
# Apply manifests
kubectl apply -f deployment.yaml
kubectl apply -f ./manifests/
# Scale deployment
kubectl scale deployment/<name> --replicas=3
# Check rollout
kubectl rollout status deployment/<name>
kubectl rollout undo deployment/<name>
# Port forward
kubectl port-forward service/<name> 8080:80
# Helm operations
helm install <release> <chart>
helm upgrade <release> <chart>
helm list
helm uninstall <release>
Important Notes
- Reference files contain comprehensive details - load them as needed to avoid context overhead
- Always validate configurations before applying to production
- Use namespaces for resource isolation
- Set resource requests and limits for all containers
- Implement health checks (liveness, readiness, startup probes)
- Use PodDisruptionBudgets for high availability
- Store sensitive data in Secrets, not ConfigMaps
- Tag images with specific versions, avoid
:latestin production
Integration Points
This skill works well with:
- Docker for container image management
- Git for manifest version control (GitOps)
- Terraform for infrastructure provisioning
- CI/CD pipelines for automated deployments
- Monitoring tools (Prometheus, Grafana) for observability
- Logging systems (EFK stack) for centralized logging
Remember: Load the specific reference files only when you need detailed information about kubectl commands, Helm operations, specific workflows, or best practices. This keeps the context manageable and efficient.