kubernetes-operations
Kubernetes cluster operations including pods, services, deployments, and logs. Use when managing Kubernetes workloads, debugging pod issues, or checking cluster status.
When & Why to Use This Skill
The Kubernetes Operations skill empowers users to manage and troubleshoot Kubernetes clusters directly through an AI interface. It provides comprehensive capabilities for monitoring pod health, inspecting services, and analyzing deployments. By integrating essential MCP tools like k8s_pods and k8s_pod_logs, it streamlines the process of diagnosing container failures, reviewing cluster events, and ensuring infrastructure stability, making it an indispensable tool for DevOps engineers and SREs.
Use Cases
- Real-time Cluster Monitoring: Quickly list and verify the status of pods, services, and deployments across multiple namespaces to maintain operational visibility.
- Automated Incident Diagnosis: Identify the root cause of container issues such as CrashLoopBackOff, OOMKilled, or ImagePullBackOff by analyzing pod descriptions and cluster events.
- Log Retrieval and Analysis: Access and tail container logs to debug application-level errors, performance bottlenecks, or failed startup sequences without leaving the chat.
- Infrastructure Configuration Audit: Verify service endpoints, port mappings, and resource limits to ensure that the network routing and resource allocations are correctly configured.
| name | kubernetes-operations |
|---|---|
| description | Kubernetes cluster operations including pods, services, deployments, and logs. Use when managing Kubernetes workloads, debugging pod issues, or checking cluster status. |
| allowed-tools | Bash, Read, Write |
Kubernetes Operations Skill
Version: 1.0.0 Purpose: Kubernetes cluster management and debugging
Triggers
| Trigger | Examples |
|---|---|
| Pods | "list pods", "pod status", "Pod一覧" |
| Services | "list services", "サービス一覧" |
| Logs | "pod logs", "ログ確認" |
| Debug | "debug pod", "Pod調査" |
Prerequisites
# kubectl configured with cluster access
kubectl cluster-info
# Optional: Set default namespace
kubectl config set-context --current --namespace=myapp
Integrated MCP Tools
| Tool | Purpose |
|---|---|
k8s_pods |
List pods in namespace |
k8s_services |
List services |
k8s_deployments |
List deployments |
k8s_pod_logs |
Pod container logs |
k8s_pod_describe |
Detailed pod info |
k8s_namespaces |
List namespaces |
Workflow: Pod Debugging
Phase 1: Assessment
Step 1.1: List Pods
Use k8s_pods with:
- namespace: Target namespace (or default)
Check for:
- Pod status (Running, Pending, Failed)
- Restart count
- Age
Step 1.2: Check Services
Use k8s_services to verify:
- Service endpoints
- Port mappings
- Selectors
Phase 2: Investigation
Step 2.1: Pod Details
Use k8s_pod_describe with:
- pod_name: Target pod
- namespace: Pod namespace
Look for:
- Events (warnings, errors)
- Container status
- Resource limits
- Node assignment
Step 2.2: View Logs
Use k8s_pod_logs with:
- pod_name: Target pod
- container: Container name (if multi-container)
- tail: 100 (last N lines)
- previous: true (if crashed)
Phase 3: Common Fixes
| Status | Cause | Solution |
|---|---|---|
| Pending | No resources | Check node capacity |
| CrashLoopBackOff | App error | Check logs, fix code |
| ImagePullBackOff | Image issue | Verify image name, credentials |
| OOMKilled | Memory limit | Increase memory limit |
Quick Reference
Pod States
Pending → Waiting for scheduling
Running → Container(s) running
Succeeded → Completed successfully
Failed → Container exited with error
Unknown → State cannot be determined
Common Commands
# Get all resources
kubectl get all -n namespace
# Watch pods
kubectl get pods -w
# Exec into pod
kubectl exec -it pod-name -- /bin/sh
Best Practices
✅ GOOD:
- Set resource requests/limits
- Use liveness/readiness probes
- Check events on failures
- Use namespaces for isolation
❌ BAD:
- No resource limits
- Ignore probe failures
- Delete pods without investigation
- Run everything in default namespace
Checklist
- kubectl configured
- Namespace specified
- Pod status checked
- Events reviewed
- Logs examined
- Resources adequate