Rohit Ghumare

Kubernetes Skills

运维安全v1.0.0
作者:Rohit Ghumare更新于 2026-05-18k8s-capi@clawhub_rohitg00/k8s-capi
服务器运维DevOps#Kubernetes

据 AlphaMoat 统计,截至 2026-09,Kubernetes Skills 累计下载 3,460 次、获 2 个星标,在全部 5,078 个 AI 技能中排名第 3,206 位,在「运维安全」分类(264 个)中排名第 207 位。

累计安装
102
累计下载
3,460
星标
2
全站排名
#3,206
全站前 64% · 「运维安全」前 79%
平台累计安装累计下载星标评论
ClawHub ↗1023,1261-
SkillHub ↗1013,4602—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

可检查集群、机器和部署状态,获取工作负载集群 kubeconfig,并规划集群创建、工作节点扩缩和版本升级。应用 manifest、改变副本数或升级可能影响工作负载和基础设施成本;kubeconfig 含访问凭据。执行前应核对目标集群、配置和变更范围。

资料发布于 2026-10-29

可以用来做什么

  • 检查 CAPI 安装情况及集群、机器和部署状态。
  • 获取工作负载集群 kubeconfig 或查看集群配置。
  • 规划集群创建、工作节点扩缩或 Kubernetes 版本升级。

什么时候用

  • 需要检查或管理 Kubernetes Cluster API 集群生命周期时。
  • 需要诊断集群或机器 provisioning 状态时。
  • 应用配置、扩缩节点、升级版本或输出 kubeconfig 前,需要核实目标、影响和访问权限时。

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

只读检查指定 namespace 中的集群和机器状态,不应用 manifest 或改变副本数。
在扩缩或升级集群前列出目标集群、当前状态和预期变更,等待确认;不要输出 kubeconfig 凭据。

月度数据趋势

累计下载3,460
1,9272,7513,5742026-03 · 累计下载 2,0412026-05 · 累计下载 2,5702026-06 · 累计下载 2,6972026-07 · 累计下载 2,9532026-08 · 累计下载 3,1712026-09 · 累计下载 3,46026-0326-09
星标2
1222026-03 · 星标 12026-05 · 星标 22026-06 · 星标 12026-07 · 星标 22026-08 · 星标 22026-09 · 星标 226-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-093,460—2
2026-083,171+7.4%2
2026-072,953+9.5%2
2026-062,697+4.9%1
2026-052,570—2
2026-032,041—1

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

5.8 KB · ClawHub v2.0.0
---
name: k8s-capi
description: Cluster API lifecycle management for provisioning, scaling, and upgrading Kubernetes clusters. Use when managing cluster infrastructure or multi-cluster operations.
license: MIT-0
metadata:
  author: rohitg00
  version: "2.0.0"
  tools: 13
  category: infrastructure
---
展开全部(共 259 行)

# Cluster API Lifecycle Management

Manage Kubernetes clusters using kubectl-mcp-server's Cluster API tools (11 tools).

> Requires the `capi` toolset: start kubectl-mcp-server with `--toolsets default,capi` (or `MCP_TOOLSETS=default,capi`).

## When to Apply

Use this skill when:
- User mentions: "Cluster API", "CAPI", "cluster lifecycle", "machine", "workload cluster"
- Operations: provisioning clusters, scaling nodes, upgrading Kubernetes versions
- Keywords: "provision cluster", "scale workers", "machine deployment", "cluster class"

## Priority Rules

| Priority | Rule | Impact | Tools |
|----------|------|--------|-------|
| 1 | Detect CAPI installation first | CRITICAL | `detect_ecosystem` |
| 2 | Check cluster phase before operations | HIGH | `capi_get_cluster` |
| 3 | Monitor machines during scaling | HIGH | `capi_list_machines` |
| 4 | Get kubeconfig after provisioning | MEDIUM | `capi_get_cluster_kubeconfig` |

## Quick Reference

| Task | Tool | Example |
|------|------|---------|
| Detect CAPI | `detect_ecosystem` | `detect_ecosystem()` |
| List clusters | `capi_list_clusters` | `capi_list_clusters(namespace)` |
| Get cluster kubeconfig | `capi_get_cluster_kubeconfig` | `capi_get_cluster_kubeconfig(name, namespace)` |
| Scale workers | `capi_scale_machinedeployment` | `capi_scale_machinedeployment(name, namespace, replicas)` |

## Check Installation

```python
detect_ecosystem()
```

## List Clusters

```python
# List all CAPI clusters
capi_list_clusters(namespace="default")

# Shows:
# - Cluster name
# - Phase (Provisioning, Provisioned, Deleting)
# - Infrastructure ready
# - Control plane ready
```

## Get Cluster Details

```python
capi_get_cluster(name="my-cluster", namespace="default")

# Shows:
# - Spec (control plane, infrastructure)
# - Status (phase, conditions)
# - Network configuration
```

## Get Cluster Kubeconfig

```python
# Get kubeconfig for workload cluster
capi_get_cluster_kubeconfig(name="my-cluster", namespace="default")

# Returns kubeconfig to access the cluster
```

## Machines

### List Machines

```python
capi_list_machines(namespace="default")

# Shows:
# - Machine name
# - Cluster
# - Phase (Running, Provisioning, Failed)
# - Provider ID
# - Version
```

### Get Machine Details

```python
capi_get_machine(name="my-cluster-md-0-xxx", namespace="default")
```

## Machine Deployments

### List Machine Deployments

```python
capi_list_machinedeployments(namespace="default")

# Shows:
# - Deployment name
# - Cluster
# - Replicas (ready/total)
# - Version
```

### Scale Machine Deployment

```python
# Scale worker nodes
capi_scale_machinedeployment(
    name="my-cluster-md-0",
    namespace="default",
    replicas=5
)
```

## Machine Sets

```python
capi_list_machinesets(namespace="default")
```

## Machine Health Checks

```python
capi_list_machinehealthchecks(namespace="default")

# Health checks automatically remediate unhealthy machines
```

## Cluster Classes

```python
# List cluster templates
capi_list_clusterclasses(namespace="default")

# ClusterClasses define reusable cluster configurations
```

## Create Cluster

```python
kubectl_apply(manifest="""
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: my-cluster
  namespace: default
spec:
  clusterNetwork:
    pods:
      cidrBlocks:
      - 192.168.0.0/16
    services:
      cidrBlocks:
      - 10.96.0.0/12
  controlPlaneRef:
    apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    kind: KubeadmControlPlane
    name: my-cluster-control-plane
  infrastructureRef:
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: AWSCluster
    name: my-cluster
""")
```

## Create Machine Deployment

```python
kubectl_apply(manifest="""
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
  name: my-cluster-md-0
  namespace: default
spec:
  clusterName: my-cluster
  replicas: 3
  selector:
    matchLabels:
      cluster.x-k8s.io/cluster-name: my-cluster
  template:
    spec:
      clusterName: my-cluster
      version: v1.28.0
      bootstrap:
        configRef:
          apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
          kind: KubeadmConfigTemplate
          name: my-cluster-md-0
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
        kind: AWSMachineTemplate
        name: my-cluster-md-0
""")
```

## Cluster Lifecycle Workflows

### Provision New Cluster
```python
1. kubectl_apply(cluster_manifest)
2. capi_list_clusters(namespace)  # Wait for Provisioned
3. capi_get_cluster_kubeconfig(name, namespace)  # Get access
```

### Scale Workers
```python
1. capi_list_machinedeployments(namespace)
2. capi_scale_machinedeployment(name, namespace, replicas)
3. capi_list_machines(namespace)  # Monitor
```

### Upgrade Cluster
```python
1. # Update control plane version
2. # Update machine deployment version
3. capi_list_machines(namespace)  # Monitor rollout
```

## Troubleshooting

### Cluster Stuck Provisioning

```python
1. capi_get_cluster(name, namespace)  # Check conditions
2. capi_list_machines(namespace)  # Check machine status
3. kubectl_get(resource_type="events", namespace)  # Check events
4. # Check infrastructure provider logs
```

### Machine Failed

```python
1. capi_get_machine(name, namespace)
2. kubectl_get(resource_type="events", namespace)
3. # Common issues:
   # - Cloud provider quota
   # - Invalid machine template
   # - Network issues
```

## Related Skills

- [k8s-multicluster](../k8s-multicluster/SKILL.md) - Multi-cluster operations
- [k8s-operations](../k8s-operations/SKILL.md) - kubectl operations

「运维安全」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。