TopRank Skills

Home / Claw Skills / DevOps / kubectl-skill
Official OpenClaw rules 36%

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.

Stars

0

Installs

0

Status

ACTIVE

Visibility

PUBLIC

安装方式

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 kubectl-skill 技能。 若已安装,则直接安装 kubectl-skill 技能。

Overview

Skill Key
ddevaal/kubectl
Author
ddevaal
Source Repo
openclaw/skills
Version
-
Source Path
skills/ddevaal/kubectl
Latest Commit SHA
3ebe5c656162f7fcd5f4e6e76093e2c4e9c58c05

Extracted Content

SKILL.md excerpt

# 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:**
```bash
brew install kubernetes-cli
```

**Linux:**
```bash
apt-get install -y kubectl  # Ubuntu/Debian
yum install -y kubectl      # RHEL/CentOS
```

**Verify:**
```bash
kubectl version --client
kubectl cluster-info  # Test connection
```

## Essential Commands

### Query Resources
```bash
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
```bash
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
```bash
kubectl exec -it POD_NAME -- /bin/bash   # Interactive shell
kubectl exec POD_NAME -- COMMAND         # Run single command
```

### Deploy Applications
```bash
kubectl apply -f deployment.yaml...

README excerpt

# 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
```bash
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
```bash
kubectl version --client
kubectl cluster-info
```

### Basic Commands
```bash
# 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:
```bash
chmod +x scripts/*.sh
```

### Debug a Pod
```bash
./scripts/kubectl-pod-debug.sh POD_NAME [NAMESPACE]
```

### Update Deployment Image
```bash
./scripts/kubectl-deploy-update.sh DEPLOYMENT CONTAINER IMAGE [NAMESPACE]
```

### Drain Node for Maintenance
```bash
./scripts/kubectl-node-drain.sh NODE_NAME
```

### Check Cluster Health
```bash
./scripts/kubectl-cluster-info.sh
```

## Structure

```
kubectl-skill/
├── SKILL.md                    # Main skill instructions
├── LICENSE...

Related Claw Skills