k8s-operations
Automate routine kubectl tasks and lifecycle management for Kubernetes resources.
Install
mkdir -p .claude/skills/k8s-operations && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4908" && unzip -o skill.zip -d .claude/skills/k8s-operations && rm skill.zipInstalls to .claude/skills/k8s-operations
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
kubectl operations for applying, patching, deleting, and executing commands on Kubernetes resources. Use when modifying resources, running commands in pods, or managing resource lifecycle.Key capabilities
- →Apply Kubernetes manifests from a string or file path
- →Patch existing Kubernetes resources with strategic or JSON merge patches
- →Delete Kubernetes resources by type, name, or label selector
- →Execute commands inside running pods, optionally specifying a container
- →Scale Kubernetes deployments or statefulsets to a desired replica count
- →Manage rollout status, history, and restarts for deployments
How it works
This skill executes kubectl commands through a tool to apply, patch, delete, or run commands on Kubernetes resources, supporting various operational tasks.
Inputs & outputs
When to use k8s-operations
- →Apply YAML manifests to a cluster
- →Scale a deployment to manage load
- →Execute shell commands inside a running pod
- →Patch resource configurations
About this skill
kubectl Operations
Execute kubectl commands using kubectl-mcp-server's operations tools.
When to Apply
Use this skill when:
- User mentions: "apply", "patch", "delete", "exec", "scale", "rollout"
- Operations: modifying resources, running commands, scaling workloads
- Keywords: "update", "change", "modify", "run command", "restart"
Priority Rules
| Priority | Rule | Impact | Tools |
|---|---|---|---|
| 1 | Dry run before apply in production | CRITICAL | kubectl_apply(dry_run=True) |
| 2 | Check current state before patching | HIGH | describe_* tools |
| 3 | Avoid force delete unless necessary | HIGH | kubectl_delete |
| 4 | Verify rollout status after changes | MEDIUM | kubectl_rollout_status |
Quick Reference
| Task | Tool | Example |
|---|---|---|
| Apply manifest | kubectl_apply | kubectl_apply(manifest=yaml) |
| Patch resource | kubectl_patch | kubectl_patch(type, name, namespace, patch) |
| Delete resource | kubectl_delete | kubectl_delete(type, name, namespace) |
| Exec command | kubectl_exec | kubectl_exec(pod, namespace, command) |
| Scale deployment | scale_deployment | scale_deployment(name, namespace, replicas) |
Apply Resources
kubectl_apply(manifest="""
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: default
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
""")
kubectl_apply(file_path="/path/to/manifest.yaml")
kubectl_apply(manifest="...", dry_run=True)
Patch Resources
kubectl_patch(
resource_type="deployment",
name="nginx",
namespace="default",
patch={"spec": {"replicas": 5}}
)
kubectl_patch(
resource_type="deployment",
name="nginx",
namespace="default",
patch=[{"op": "replace", "path": "/spec/replicas", "value": 5}],
patch_type="json"
)
kubectl_patch(
resource_type="service",
name="my-svc",
namespace="default",
patch={"metadata": {"annotations": {"key": "value"}}},
patch_type="merge"
)
Delete Resources
kubectl_delete(resource_type="pod", name="my-pod", namespace="default")
kubectl_delete(
resource_type="pods",
namespace="default",
label_selector="app=test"
)
kubectl_delete(
resource_type="pod",
name="stuck-pod",
namespace="default",
force=True,
grace_period=0
)
Execute Commands
kubectl_exec(
pod="my-pod",
namespace="default",
command="ls -la /app"
)
kubectl_exec(
pod="my-pod",
namespace="default",
container="sidecar",
command="cat /etc/config/settings.yaml"
)
kubectl_exec(
pod="my-pod",
namespace="default",
command="sh -c 'curl -s localhost:8080/health'"
)
Scale Resources
scale_deployment(name="nginx", namespace="default", replicas=5)
scale_deployment(name="nginx", namespace="default", replicas=0)
kubectl_scale(
resource_type="statefulset",
name="mysql",
namespace="default",
replicas=3
)
Rollout Management
kubectl_rollout_status(
resource_type="deployment",
name="nginx",
namespace="default"
)
kubectl_rollout_history(
resource_type="deployment",
name="nginx",
namespace="default"
)
kubectl_rollout_restart(
resource_type="deployment",
name="nginx",
namespace="default"
)
rollback_deployment(name="nginx", namespace="default", revision=1)
Labels and Annotations
kubectl_label(
resource_type="pod",
name="my-pod",
namespace="default",
labels={"env": "production"}
)
kubectl_annotate(
resource_type="deployment",
name="nginx",
namespace="default",
annotations={"description": "Main web server"}
)
Related Skills
- k8s-deploy - Deployment strategies
- k8s-helm - Helm operations
How it compares
This skill automates common kubectl operations, providing a programmatic interface for Kubernetes resource management instead of manual command-line execution.
Compared to similar skills
k8s-operations side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| k8s-operations (this skill) | 1 | 6mo | Review | Intermediate |
| k8s-gitops | 1 | 6mo | Review | Intermediate |
| terminal | 0 | 1mo | No flags | Intermediate |
| bazel-build-optimization | 14 | 2mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by rohitg00
View all by rohitg00 →You might also like
k8s-gitops
rohitg00
Manage GitOps workflows with Flux and ArgoCD. Use for sync status, reconciliation, app management, source management, and GitOps troubleshooting.
terminal
fisker086
Execute shell commands on the server
bazel-build-optimization
wshobson
Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
linkerd-patterns
wshobson
Implement Linkerd service mesh patterns for lightweight, security-focused service mesh deployments. Use when setting up Linkerd, configuring traffic policies, or implementing zero-trust networking with minimal overhead.
github-actions-templates
wshobson
Create production-ready GitHub Actions workflows for automated testing, building, and deploying applications. Use when setting up CI/CD with GitHub Actions, automating development workflows, or creating reusable workflow templates.
storage-networking
pluginagentmarketplace
Master Kubernetes storage management and networking architecture. Learn persistent storage, network policies, service discovery, and ingress routing.