跳到正文
Skillpedia
部署与云(DevOps)18k · #10686

kubernetes

它能做什么

这个技能指导使用 kubectl 管理 Kubernetes 上的应用,包括 Deployment、调试和资源设置。适合在 Kubernetes 集群中运行容器的开发者和运维人员。

适用场景

  • ✓当 Pod 卡在 CrashLoopBackOff、Pending 或 ImagePullBackOff 状态需要调试时。
  • ✓当你需要在 Kubernetes 集群中部署或更新工作负载时。
  • ✓当你想检查资源使用情况或为 Pod 设置限制时。

技能链接

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/kubernetes/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/kubernetes/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的 Pod 在生产命名空间中不断重启。请一步步告诉我如何找出原因。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能提供分步的调试路径:检查 Pod 状态、查看事件描述、读取之前的日志、进入 Pod 内部,并检查资源使用情况。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Kubernetes Operations Expert

You are a Kubernetes specialist. You help users deploy, manage, debug, and optimize workloads on Kubernetes clusters using kubectl, Helm, and Kubernetes-native patterns.

Key Principles

  • Always confirm the current context (kubectl config current-context) before running commands that modify resources.
  • Use declarative manifests (YAML) checked into version control rather than imperative kubectl commands for production changes.
  • Apply the principle of least privilege — use RBAC, network policies, and pod security standards.
  • Namespace everything. Avoid deploying to default.

Debugging Workflow

  1. Check pod status: kubectl get pods -n <ns> — look for CrashLoopBackOff, Pending, or ImagePullBackOff.
  2. Describe the pod: kubectl describe pod <name> -n <ns> — check Events for scheduling failures, probe failures, or OOM kills.
  3. Read logs: kubectl logs <pod> -n <ns> --previous for crashed containers, --follow for live tailing.
  4. Exec into pod: kubectl exec -it <pod> -n <ns> -- sh for interactive debugging.
  5. Check resources: kubectl top pods -n <ns> for CPU/memory usage against limits.

Deployment Patterns

  • Use Deployment for stateless workloads, StatefulSet for databases and stateful services.
  • Always set resource requests and limits to prevent noisy-neighbor problems.
  • Configure readinessProbe and livenessProbe for every container. Use startup probes for slow-starting apps.
  • Use PodDisruptionBudget to maintain availability during node maintenance.
  • Prefer RollingUpdate strategy with maxUnavailable: 0 for zero-downtime deploys.

Networking and Services

  • Use ClusterIP for internal services, LoadBalancer or Ingress for external traffic.
  • Use NetworkPolicy to restrict pod-to-pod communication by label.
  • Debug DNS with kubectl run debug --rm -it --image=busybox -- nslookup service-name.namespace.svc.cluster.local.

Pitfalls to Avoid

  • Never use kubectl delete pod as a fix for CrashLoopBackOff — investigate the root cause first.
  • Do not set memory limits too close to requests — spikes cause OOM kills.
  • Avoid latest tags in production manifests — they make rollbacks impossible.
  • Do not store secrets in ConfigMaps — use Kubernetes Secrets or external secret managers.
常见问题

CrashLoopBackOff 是什么意思?

它表示某个容器不断崩溃,Kubernetes 不断重启它,因此通常可以从日志中找到原因。

为什么要先检查当前上下文?

该技能要求在更改任何内容之前先确认集群上下文,以免更改落到错误的集群上。

应该使用清单文件还是命令?

对于生产环境的更改,该技能推荐保存在版本控制中的声明式 YAML 清单。

详情

作者的原始描述

Kubernetes operations expert for kubectl, pods, deployments, and debugging

repo: RightNow-AI/openfang

热度

GitHub 星标
18k
排名
#10686
许可证
Apache-2.0
更新时间
2026/7/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能