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 get to list resources
- Use
kubectl describe for detailed information
- Apply changes with
kubectl apply or kubectl patch
- Monitor with
kubectl rollout status or kubectl 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 get and kubectl logs
- Rollback if needed with
kubectl rollout undo
Key Principles
Safety First
- Always verify context and namespace before operations
- Use
--dry-run=client or --dry-run=server to validate changes
- Use
kubectl diff to preview changes before applying
- Be cautious with destructive operations (delete, force, drain)
Declarative Over Imperative
- Prefer
kubectl apply -f file.yaml over 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-selector and sort with --sort-by
- Watch resources in real-time with
-w flag
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
:latest in 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.
1---2name: kubernetes3description: 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.4---5
6# Kubernetes Management Skill
7
8This skill provides comprehensive capabilities for managing Kubernetes clusters, resources, and workloads using kubectl, Helm, and Kustomize.
9
10## When to Use This Skill
11
12Use this skill when working with:
13- Kubernetes resources (pods, deployments, services, configmaps, secrets, etc.)
14- Debugging containerized applications and troubleshooting cluster issues
15- Helm chart installation, upgrades, and management
16- kubectl operations (get, describe, apply, create, delete, logs, exec, scale, rollout)
17- Context and namespace management
18- Deployment strategies (rolling updates, blue-green, canary)
19- Configuration management and resource optimization
20
21## How to Use This Skill
22
23### 1. Verify Context and Namespace
24
25**Always start by verifying your current context and namespace:**
26```bash
27kubectl config current-context
28kubectl config view --minify
29```
30
31Set namespace if needed:
32```bash
33kubectl config set-context --current --namespace=<namespace>
34```
35
36### 2. Load Appropriate Reference Files
37
38Based on the task at hand, load the relevant reference documentation:
39
40**For kubectl Operations:**
41Load [kubectl Reference](./references/kubectl_reference.md) when you need detailed information about:
42- Getting, describing, creating, updating, or deleting resources
43- Viewing logs or executing commands in containers
44- Port forwarding and debugging
45- Scaling deployments
46- Managing rollouts and rollbacks
47- Context and namespace operations
48- Output formats and filtering
49
50**For Helm Operations:**
51Load [Helm Reference](./references/helm_reference.md) when you need detailed information about:
52- Installing or upgrading Helm charts
53- Managing releases (list, status, uninstall, rollback)
54- Repository management
55- Chart development and inspection
56- Values configuration and overrides
57- Troubleshooting Helm issues
58
59**For Common Workflows:**
60Load [Workflows Reference](./references/workflows.md) when you need guidance on:
61- Debugging failing pods or services
62- Deploying applications
63- Updating deployments with different strategies
64- Blue-green and canary deployments
65- Configuration management (ConfigMaps and Secrets)
66- Maintenance operations (draining nodes, backup/restore)
67- Cluster inspection and cleanup
68
69**For Best Practices:**
70Load [Best Practices Reference](./references/best_practices.md) when you need guidance on:
71- Safety and validation before operations
72- Efficiency and optimization
73- Debugging approaches
74- YAML and manifest management
75- High availability patterns
76- Error handling and troubleshooting
77- Integration with other tools
78- Environment-specific practices
79
80### 3. General Workflow
81
82**For Resource Management:**
831. Verify context and namespace
842. Use `kubectl get` to list resources
853. Use `kubectl describe` for detailed information
864. Apply changes with `kubectl apply` or `kubectl patch`
875. Monitor with `kubectl rollout status` or `kubectl get events`
88
89**For Debugging:**
901. Check pod status with `kubectl get pods`
912. Describe the resource with `kubectl describe`
923. View logs with `kubectl logs`
934. Check events with `kubectl get events`
945. Exec into container if needed with `kubectl exec -it`
95
96**For Deployments:**
971. Validate manifests with `--dry-run`
982. Apply manifests with `kubectl apply`
993. Monitor rollout with `kubectl rollout status`
1004. Verify with `kubectl get` and `kubectl logs`
1015. Rollback if needed with `kubectl rollout undo`
102
103## Key Principles
104
105### Safety First
106- Always verify context and namespace before operations
107- Use `--dry-run=client` or `--dry-run=server` to validate changes
108- Use `kubectl diff` to preview changes before applying
109- Be cautious with destructive operations (delete, force, drain)
110
111### Declarative Over Imperative
112- Prefer `kubectl apply -f file.yaml` over imperative commands
113- Store manifests in version control
114- Use Kustomize for environment-specific overlays
115- Make infrastructure reproducible and auditable
116
117### Efficient Resource Usage
118- Use label selectors to operate on groups of resources
119- Use output formats (`-o json|yaml`) for automation and parsing
120- Filter with `--field-selector` and sort with `--sort-by`
121- Watch resources in real-time with `-w` flag
122
123### Systematic Debugging
124- Follow the debugging workflow: status → describe → logs → events → exec
125- Use timestamps in logs for correlation
126- Check recent events with `kubectl get events --sort-by='.lastTimestamp'`
127- Test connectivity with temporary debug pods
128
129## Quick Command Reference
130
131**Most Common Operations:**
132```bash
133# Get resources
134kubectl get pods
135kubectl get pods -o wide
136kubectl get pods -l app=myapp
137
138# Describe for details
139kubectl describe pod <pod-name>
140
141# View logs
142kubectl logs <pod-name>
143kubectl logs <pod-name> -f
144kubectl logs <pod-name> --previous
145
146# Exec into pod
147kubectl exec -it <pod-name> -- /bin/sh
148
149# Apply manifests
150kubectl apply -f deployment.yaml
151kubectl apply -f ./manifests/
152
153# Scale deployment
154kubectl scale deployment/<name> --replicas=3
155
156# Check rollout
157kubectl rollout status deployment/<name>
158kubectl rollout undo deployment/<name>
159
160# Port forward
161kubectl port-forward service/<name> 8080:80
162
163# Helm operations
164helm install <release> <chart>
165helm upgrade <release> <chart>
166helm list
167helm uninstall <release>
168```
169
170## Important Notes
171
172- Reference files contain comprehensive details - load them as needed to avoid context overhead
173- Always validate configurations before applying to production
174- Use namespaces for resource isolation
175- Set resource requests and limits for all containers
176- Implement health checks (liveness, readiness, startup probes)
177- Use PodDisruptionBudgets for high availability
178- Store sensitive data in Secrets, not ConfigMaps
179- Tag images with specific versions, avoid `:latest` in production
180
181## Integration Points
182
183This skill works well with:
184- **Docker** for container image management
185- **Git** for manifest version control (GitOps)
186- **Terraform** for infrastructure provisioning
187- **CI/CD pipelines** for automated deployments
188- **Monitoring tools** (Prometheus, Grafana) for observability
189- **Logging systems** (EFK stack) for centralized logging
190
191---
192
193**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.