K8

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.zip

Installs 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.
188 chars✓ has a “when” trigger
Intermediate

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

You give it
Kubernetes resource manifests, resource types, names, namespaces, patch definitions, or commands to execute
You get back
Result of kubectl operation, such as resource creation, modification, deletion, or command output

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.

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

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

PriorityRuleImpactTools
1Compare with live state before apply in productionCRITICALkubectl_get(resource_type, name, output="yaml")
2Check current state before patchingHIGHkubectl_describe
3Avoid force delete unless necessaryHIGHdelete_resource
4Verify rollout status after changesMEDIUMkubectl_rollout

Quick Reference

TaskToolExample
Apply manifestkubectl_applykubectl_apply(manifest=yaml)
Patch resourcekubectl_patchkubectl_patch(type, name, namespace, patch)
Delete resourcedelete_resourcedelete_resource(type, name, namespace)
Exec commandexec_in_podexec_in_pod(pod, namespace, command)
Scale deploymentkubectl_scalekubectl_scale(resource_type="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
""")

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

delete_resource(resource_type="pod", name="my-pod", namespace="default")

delete_resource(resource_type="deployment", name="old-app", namespace="default")

Execute Commands

exec_in_pod(
    pod_name="my-pod",
    namespace="default",
    command="ls -la /app"
)

exec_in_pod(
    pod_name="my-pod",
    namespace="default",
    container="sidecar",
    command="cat /etc/config/settings.yaml"
)

exec_in_pod(
    pod_name="my-pod",
    namespace="default",
    command="sh -c 'curl -s localhost:8080/health'"
)

Scale Resources

kubectl_scale(resource_type="deployment", name="nginx", namespace="default", replicas=5)

kubectl_scale(resource_type="deployment", name="nginx", namespace="default", replicas=0)

kubectl_scale(
    resource_type="statefulset",
    name="mysql",
    namespace="default",
    replicas=3
)

Rollout Management

kubectl_rollout(action="status",
    resource_type="deployment",
    name="nginx",
    namespace="default"
)

kubectl_rollout(action="history",
    resource_type="deployment",
    name="nginx",
    namespace="default"
)

kubectl_rollout(action="restart",
    resource_type="deployment",
    name="nginx",
    namespace="default"
)

kubectl_rollout(action="undo", resource_type="deployment", name="nginx", namespace="default")

Labels and Annotations

label_resource(
    resource_type="pod",
    name="my-pod",
    namespace="default",
    labels={"env": "production"}
)

annotate_resource(
    resource_type="deployment",
    name="nginx",
    namespace="default",
    annotations={"description": "Main web server"}
)

Related Skills

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.

SkillInstallsUpdatedSafetyDifficulty
k8s-operations (this skill)19moReviewIntermediate
k8s-gitops19moReviewIntermediate
terminal05moNo flagsIntermediate
bazel-build-optimization146moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by rohitg00

View all by rohitg00 →

Search skills

Search the agent skills registry