一键导入
k8s-ops
Manage Kubernetes cluster resources via kubectl. Use when user needs to view, troubleshoot, or modify K8s workloads across multiple clusters.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Manage Kubernetes cluster resources via kubectl. Use when user needs to view, troubleshoot, or modify K8s workloads across multiple clusters.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when designing a new feature or system, making architecture decisions, writing technical design docs, or structuring project documentation. Triggers on "design", "architecture", "technical design", "ADR", "system decomposition", "how should I structure this", "设计方案", "架构设计", "技术方案", "文档体系", "写 User Story", "写文档". Also use when reviewing existing architecture docs or asking "where should I put this doc?"
Batch-scan workspace Flutter/Android/iOS/Node.js projects, report cache usage, and perform tiered cleanup to free disk space. Triggers when the user says "clean cache", "disk space low", "free up space", or similar.
Use when reviewing code changes — MR/PR review, local commits, or uncommitted changes. Reviews document compliance, content quality (architecture soundness, test completeness, observability coverage), and end-to-end consistency (User Story ↔ design ↔ code ↔ tests ↔ observability). Triggers on "review MR", "review this commit", "review my changes", "code review", "help me review".
Cross-platform code submission workflow - Lint check, non-destructive review, manual verification document, smart staging, clean commit, MR creation. Auto-detects project type (Android/iOS/backend) and adapts to the corresponding lint/build tools. Triggers when the user says "submit code", "prepare to submit", "submit", "start submission flow", or "code submit".
Standard R&D process orchestrator — guides the full development lifecycle from User Story to CD. Invoke when user says "start a new feature", "new requirement", "我要开发一个新功能", "开始需求", "next step?", "研发流程", or resumes work on an existing feature. Also invoke proactively when any non-trivial feature work begins, even if the user just says "let's build X". Do NOT invoke for one-off bug fixes, hotpatches, or purely exploratory tasks with no deliverable.
Write documents using the HWPR/AWOR framework -- separating human value judgments from AI-expanded content so critical information is not buried. Triggers when the user requests writing, rewriting, or reviewing document quality.
| name | k8s-ops |
| description | Manage Kubernetes cluster resources via kubectl. Use when user needs to view, troubleshoot, or modify K8s workloads across multiple clusters. |
Assists operations engineers in managing K8s cluster resources via kubectl. Supports viewing, troubleshooting, and change operations.
Applicable scenarios:
Before using this skill, configure your cluster contexts in the table below. Replace the example entries with your actual clusters:
| Cluster | Context | Cloud Provider | k8s Repo Directory |
|---|---|---|---|
| prod-1 | your-eks-context-here | AWS EKS | clusters/prod-1/ |
| staging | your-gke-context-here | GCP GKE | clusters/staging/ |
| dev | your-aks-context-here | Azure AKS | clusters/dev/ |
Add all clusters your team manages. The context value should match the output of
kubectl config get-contexts.
On first operation, the Agent should automatically check the environment:
kubectl version --client to confirm kubectl is installedkubectl config get-contexts to list configured contextsIf kubectl is not installed: Guide the user to install it (brew install kubectl / apt install kubectl / official documentation).
If the target context is not configured:
aws eks update-kubeconfig --name <cluster-name> --region <region>gcloud container clusters get-credentials <cluster-name> --region <region> --project <project>, and ensure gke-gcloud-auth-plugin is installedaz aks get-credentials --resource-group <rg> --name <cluster-name>If already configured: Proceed directly to Step 2.
Confirm the following information with the user (proactively ask if not provided):
default if not specified, or infer from the service nameUse the --context parameter to specify the cluster — do not modify the current default context:
kubectl --context <context-name> -n <namespace> <command>
View operations carry no risk and can be executed directly:
# View Pod status
kubectl --context <ctx> -n <ns> get pods
# View Deployments
kubectl --context <ctx> -n <ns> get deployments
# View Pod logs
kubectl --context <ctx> -n <ns> logs <pod-name> --tail=100
# View events
kubectl --context <ctx> -n <ns> get events --sort-by='.lastTimestamp'
# View resource details
kubectl --context <ctx> -n <ns> describe pod <pod-name>
# View Node status
kubectl --context <ctx> get nodes
# View resource usage
kubectl --context <ctx> -n <ns> top pods
All change operations must show the user the command to be executed; execution only after user confirmation.
# Scale
kubectl --context <ctx> -n <ns> scale deployment <name> --replicas=<N>
# Rolling restart
kubectl --context <ctx> -n <ns> rollout restart deployment <name>
# Apply configuration
kubectl --context <ctx> -n <ns> apply -f <file>
# Edit ConfigMap
kubectl --context <ctx> -n <ns> edit configmap <name>
# Delete resource (high risk)
kubectl --context <ctx> -n <ns> delete <resource> <name>
# Enter a container
kubectl --context <ctx> -n <ns> exec -it <pod-name> -- /bin/sh
# Port forwarding
kubectl --context <ctx> -n <ns> port-forward <pod-name> <local>:<remote>
# View all containers in a Pod
kubectl --context <ctx> -n <ns> get pod <pod-name> -o jsonpath='{.spec.containers[*].name}'
delete namespace on prod clusterskubectl drain unless the user explicitly requests and confirms--context parameter to specify the cluster; avoid kubectl config use-context which modifies global stateUser: Help me restart payment-service on Production
AI: Rolling restart executed.
Problem: Change operation executed without user confirmation.
kubectl config use-context my-prod-context
kubectl -n prod get pods
Problem: Modified the global context, potentially affecting the user's other terminal sessions. Should use the --context parameter.
kubectl --context my-prod-context delete namespace monitoring
Problem: Deleting an entire namespace on a production cluster without confirmation.
User: Help me restart payment-service on Prod
AI: I will execute the following on the Prod cluster:
- Cluster: prod-1 (my-prod-context)
- Namespace: prod
- Command: kubectl --context my-prod-context -n prod rollout restart deployment payment-service
Confirm execution?
User: Confirmed
AI: Executed. Checking rollout status...
deployment "payment-service" successfully rolled out
User: Help me check the Pod status on Staging
AI: Let me check the kubectl environment...
kubectl is installed (v1.28.2)
But the Staging context was not found. Please run the following command to configure it:
aws eks update-kubeconfig --name staging-cluster --region <your-region>
Let me know when configuration is complete, and I will continue.
User: The api-gateway on Staging keeps CrashLoopBackOff
AI: Let me investigate:
1. Checking Pod status...
NAME READY STATUS RESTARTS AGE
api-gateway-5d4f6c7b8-x2k9z 0/1 CrashLoopBackOff 5 10m
2. Checking recent logs...
Error: failed to connect to database at <ip>:5432
3. Checking events...
Back-off restarting failed container
Analysis: Pod cannot connect to database at <ip>:5432. Recommended checks:
- Is the database service running normally
- Is a NetworkPolicy blocking the connection
- Is the database address correct in the ConfigMap/Secret
| Scenario | Condition |
|---|---|
| Emergency incident recovery | User explicitly states an emergency — confirmation steps may be skipped |
| Non-managed clusters | User provides a context not in the Setup list above |
Exemption method: /override skill=k8s-ops reason="emergency incident recovery"