kubectl-skill
Execute and manage Kubernetes clusters via kubectl commands. Query resources, deploy applications, debug containers, manage configurations, and monitor cluster health. Use when working with Kubernetes clusters, containers, deployments, or pod diagnostics.
Install
mkdir -p .claude/skills/kubectl-skill && curl -L -o skill.zip "https://mcp.directory/api/skills/download/1293" && unzip -o skill.zip -d .claude/skills/kubectl-skill && rm skill.zipInstalls to .claude/skills/kubectl-skill
About this skill
kubectl Skill
Execute Kubernetes cluster management operations using the kubectl command-line tool.
Overview
This skill enables agents to:
- Query Resources — List and get details about pods, deployments, services, nodes, etc.
- Deploy & Update — Create, apply, patch, and update Kubernetes resources
- Debug & Troubleshoot — View logs, execute commands in containers, inspect events
- Manage Configuration — Update kubeconfig, switch contexts, manage namespaces
- Monitor Health — Check resource usage, rollout status, events, and pod conditions
- Perform Operations — Scale deployments, drain nodes, manage taints and labels
Prerequisites
- kubectl binary installed and accessible on PATH (v1.20+)
- kubeconfig file configured with cluster credentials (default:
~/.kube/config) - Active connection to a Kubernetes cluster
Quick Setup
Install kubectl
macOS:
brew install kubernetes-cli
Linux:
apt-get install -y kubectl # Ubuntu/Debian
yum install -y kubectl # RHEL/CentOS
Verify:
kubectl version --client
kubectl cluster-info # Test connection
Essential Commands
Query Resources
kubectl get pods # List all pods in current namespace
kubectl get pods -A # All namespaces
kubectl get pods -o wide # More columns
kubectl get nodes # List nodes
kubectl describe pod POD_NAME # Detailed info with events
View Logs
kubectl logs POD_NAME # Get logs
kubectl logs -f POD_NAME # Follow logs (tail -f)
kubectl logs POD_NAME -c CONTAINER # Specific container
kubectl logs POD_NAME --previous # Previous container logs
Execute Commands
kubectl exec -it POD_NAME -- /bin/bash # Interactive shell
kubectl exec POD_NAME -- COMMAND # Run single command
Deploy Applications
kubectl apply -f deployment.yaml # Apply config
kubectl create -f deployment.yaml # Create resource
kubectl apply -f deployment.yaml --dry-run=client # Test
Update Applications
kubectl set image deployment/APP IMAGE=IMAGE:TAG # Update image
kubectl scale deployment/APP --replicas=3 # Scale pods
kubectl rollout status deployment/APP # Check status
kubectl rollout undo deployment/APP # Rollback
Manage Configuration
kubectl config view # Show kubeconfig
kubectl config get-contexts # List contexts
kubectl config use-context CONTEXT # Switch context
Common Patterns
Debugging a Pod
# 1. Identify the issue
kubectl describe pod POD_NAME
# 2. Check logs
kubectl logs POD_NAME
kubectl logs POD_NAME --previous
# 3. Execute debug commands
kubectl exec -it POD_NAME -- /bin/bash
# 4. Check events
kubectl get events --sort-by='.lastTimestamp'
Deploying a New Version
# 1. Update image
kubectl set image deployment/MY_APP my-app=my-app:v2
# 2. Monitor rollout
kubectl rollout status deployment/MY_APP -w
# 3. Verify
kubectl get pods -l app=my-app
# 4. Rollback if needed
kubectl rollout undo deployment/MY_APP
Preparing Node for Maintenance
# 1. Drain node (evicts all pods)
kubectl drain NODE_NAME --ignore-daemonsets
# 2. Do maintenance
# ...
# 3. Bring back online
kubectl uncordon NODE_NAME
Output Formats
The --output (-o) flag supports multiple formats:
table— Default tabular formatwide— Extended table with additional columnsjson— JSON format (useful withjq)yaml— YAML formatjsonpath— JSONPath expressionscustom-columns— Define custom output columnsname— Only resource names
Examples:
kubectl get pods -o json | jq '.items[0].metadata.name'
kubectl get pods -o jsonpath='{.items[*].metadata.name}'
kubectl get pods -o custom-columns=NAME:.metadata.name,STATUS:.status.phase
Global Flags (Available to All Commands)
-n, --namespace=<ns> # Operate in specific namespace
-A, --all-namespaces # Operate across all namespaces
--context=<context> # Use specific kubeconfig context
-o, --output=<format> # Output format (json, yaml, table, etc.)
--dry-run=<mode> # Dry-run mode (none, client, server)
-l, --selector=<labels> # Filter by labels
--field-selector=<selector> # Filter by fields
-v, --v=<int> # Verbosity level (0-9)
Dry-Run Modes
--dry-run=client— Fast client-side validation (test commands safely)--dry-run=server— Server-side validation (more accurate)--dry-run=none— Execute for real (default)
Always test with --dry-run=client first:
kubectl apply -f manifest.yaml --dry-run=client
Advanced Topics
For detailed reference material, command-by-command documentation, troubleshooting guides, and advanced workflows, see:
- references/REFERENCE.md — Complete kubectl command reference
- scripts/ — Helper scripts for common tasks
Helpful Tips
-
Use label selectors for bulk operations:
kubectl delete pods -l app=myapp kubectl get pods -l env=prod,tier=backend -
Watch resources in real-time:
kubectl get pods -w # Watch for changes -
Use
-Aflag for all namespaces:kubectl get pods -A # See pods everywhere -
Save outputs for later comparison:
kubectl get deployment my-app -o yaml > deployment-backup.yaml -
Check before you delete:
kubectl delete pod POD_NAME --dry-run=client
Getting Help
kubectl help # General help
kubectl COMMAND --help # Command help
kubectl explain pods # Resource documentation
kubectl explain pods.spec # Field documentation
Environment Variables
KUBECONFIG— Path to kubeconfig file (can include multiple paths separated by:)KUBECTL_CONTEXT— Override default context
Resources
Version: 1.0.0
License: MIT
Compatible with: kubectl v1.20+, Kubernetes v1.20+
More by openclaw
View all →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
rust-coding-skill
UtakataKyosui
Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.