skills$openclaw/kubectl-skill
ddevaal6.4k

by ddevaal

kubectl-skill – OpenClaw Skill

kubectl-skill is an OpenClaw Skills integration for devops workflows. 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.

6.4k stars7.9k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026devops

Skill Snapshot

namekubectl-skill
descriptionExecute 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. OpenClaw Skills integration.
ownerddevaal
repositoryddevaal/kubectl
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @ddevaal/kubectl
last updatedFeb 7, 2026

Maintainer

ddevaal

ddevaal

Maintains kubectl-skill in the OpenClaw Skills directory.

View GitHub profile
File Explorer
10 files
.
references
REFERENCE.md
17.4 KB
scripts
kubectl-cluster-info.sh
1.1 KB
kubectl-deploy-update.sh
1.3 KB
kubectl-node-drain.sh
1.0 KB
kubectl-pod-debug.sh
1.3 KB
_meta.json
267 B
README.md
3.9 KB
SKILL.md
7.0 KB
SKILL.md

name: kubectl-skill description: 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. license: MIT metadata: author: Dennis de Vaal d.devaal@gmail.com version: "1.0.0" keywords: "kubernetes,k8s,container,docker,deployment,pods,cluster" compatibility: Requires kubectl binary (v1.20+) and active kubeconfig connection to a Kubernetes cluster. Works on macOS, Linux, and Windows (WSL).

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

  1. kubectl binary installed and accessible on PATH (v1.20+)
  2. kubeconfig file configured with cluster credentials (default: ~/.kube/config)
  3. 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 format
  • wide — Extended table with additional columns
  • json — JSON format (useful with jq)
  • yaml — YAML format
  • jsonpath — JSONPath expressions
  • custom-columns — Define custom output columns
  • name — 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:

Helpful Tips

  1. Use label selectors for bulk operations:

    kubectl delete pods -l app=myapp
    kubectl get pods -l env=prod,tier=backend
    
  2. Watch resources in real-time:

    kubectl get pods -w  # Watch for changes
    
  3. Use -A flag for all namespaces:

    kubectl get pods -A  # See pods everywhere
    
  4. Save outputs for later comparison:

    kubectl get deployment my-app -o yaml > deployment-backup.yaml
    
  5. 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+

README.md

kubectl Skill

An Agent Skills-compatible skill package for kubectl command-line operations on Kubernetes clusters.

What's Included

  • SKILL.md — Main skill instructions (AgentSkills format)
  • references/REFERENCE.md — Complete command reference
  • scripts/ — Helper scripts for common workflows
    • kubectl-pod-debug.sh — Comprehensive pod debugging
    • kubectl-deploy-update.sh — Safe deployment image updates with monitoring
    • kubectl-node-drain.sh — Safe node maintenance with confirmation
    • kubectl-cluster-info.sh — Cluster health check

Installation

Via ClawdHub

clawdhub install kubectl-skill

Manual Installation

Copy the kubectl-skill directory to one of these locations:

  • Workspace skills (per-project): <workspace>/skills/
  • Local skills (user-wide): ~/.clawdbot/skills/
  • Extra skills folder: Configured via ~/.clawdbot/clawdbot.json

Requirements

  • kubectl v1.20+ installed and on PATH
  • kubeconfig file configured with cluster access
  • Active connection to a Kubernetes cluster

Quick Start

Verify Installation

kubectl version --client
kubectl cluster-info

Basic Commands

# List pods
kubectl get pods -A

# View logs
kubectl logs POD_NAME

# Execute in pod
kubectl exec -it POD_NAME -- /bin/bash

# Apply configuration
kubectl apply -f deployment.yaml

# Scale deployment
kubectl scale deployment/APP --replicas=3

Helper Scripts

Make scripts executable first:

chmod +x scripts/*.sh

Debug a Pod

./scripts/kubectl-pod-debug.sh POD_NAME [NAMESPACE]

Update Deployment Image

./scripts/kubectl-deploy-update.sh DEPLOYMENT CONTAINER IMAGE [NAMESPACE]

Drain Node for Maintenance

./scripts/kubectl-node-drain.sh NODE_NAME

Check Cluster Health

./scripts/kubectl-cluster-info.sh

Structure

kubectl-skill/
├── SKILL.md                    # Main skill instructions
├── LICENSE                     # MIT License
├── README.md                   # This file
├── references/
│   └── REFERENCE.md           # Complete command reference
├── scripts/
│   ├── kubectl-pod-debug.sh
│   ├── kubectl-deploy-update.sh
│   ├── kubectl-node-drain.sh
│   └── kubectl-cluster-info.sh
└── assets/                    # (Optional) For future additions

Key Features

✅ Query and inspect Kubernetes resources
✅ Deploy and update applications
✅ Debug pods and containers
✅ Manage cluster configuration
✅ Monitor resource usage and health
✅ Execute commands in running containers
✅ View logs and events
✅ Port forwarding for local testing
✅ Node maintenance operations
✅ Dry-run support for safe operations

Environment Variables

  • KUBECONFIG — Path to kubeconfig file (can include multiple paths separated by :)
  • KUBECTLDIR — Directory for kubectl plugins (optional)

Documentation

Compatibility

  • kubectl versions: v1.20+
  • Kubernetes versions: v1.20+
  • Platforms: macOS, Linux, Windows (WSL)
  • Agent frameworks: Any that supports AgentSkills format

Contributing

This skill is part of the Clawdbot project. To contribute:

  1. Test changes locally
  2. Update documentation
  3. Ensure scripts are executable and tested
  4. Submit pull request with clear description

License

MIT License — See LICENSE file for details

Support


Version: 1.0.0
Last Updated: January 24, 2026
Maintainer: Clawdbot Contributors

Permissions & Security

Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.

Requirements

1. **kubectl binary** installed and accessible on PATH (v1.20+) 2. **kubeconfig** file configured with cluster credentials (default: `~/.kube/config`) 3. **Active connection** to a Kubernetes cluster

Configuration

```bash kubectl config view # Show kubeconfig kubectl config get-contexts # List contexts kubectl config use-context CONTEXT # Switch context ```

FAQ

How do I install kubectl-skill?

Run openclaw add @ddevaal/kubectl in your terminal. This installs kubectl-skill into your OpenClaw Skills catalog.

Does this skill run locally or in the cloud?

OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.

Where can I verify the source code?

The source repository is available at https://github.com/openclaw/skills/tree/main/skills/ddevaal/kubectl. Review commits and README documentation before installing.