☸️ Kubernetes Command Quick Reference
📐 工作原理与说明
按分类聚合条目:遍历条目列表,首次出现的分类记入有序数组并把计数置 1,后续同分类累加;柱状图以分类名为横轴、条目数为数据(图高 300),明细表逐行输出序号、分类名、该分类条目数与该分类前 2 条代表命令(以「 / 」连接)。分类名在英文态下按内置映射表替换为英文(Kubernetes 命令)
Kubernetes 常用命令速查。
- kubectl:get、describe、apply、delete、logs、exec、scale、rollout、port-forward。
- 资源:Pod、Deployment、Service、ConfigMap、Secret、Ingress、Namespace。
- 排障:logs 看容器日志、exec 进入容器、describe 看事件与状态、get -o yaml 看完整定义。
- 实践:推荐用
apply -f声明式管理,而非命令式 create/run。
Browse a Kubernetes cheat sheet in your browser — kubectl commands and manifest tips.
📚 深度解析:Kubernetes 命令速查
💡 常见使用场景
- kubectl get/describe/apply 速查。
- 排查 Pod 异常:按 get → describe → logs 的顺序定位,看 Events 里是调度失败、镜像拉取失败还是容器反复重启。
查 pod
`kubectl get pods -n default` 列出命名空间 pod。
❓ 常见问题(FAQ)
- 如何重启 deployment?
- `kubectl rollout restart deploy/<name>`。
- Pod 一直 Pending 怎么办?
- 按三类原因排查:资源不足(describe 里显示 Insufficient cpu/memory,需扩容或调小 requests)、调度约束不满足(nodeSelector、亲和性、污点容忍不匹配),以及 PVC 未绑定(存储类或容量问题)。Events 通常直接给出原因,先看它。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Object model | desired state stored in etcd; controllers reconcile | Kubernetes documentation |
| Workloads | Deployment for stateless replicas; StatefulSet keeps identity | Kubernetes documentation |
| Service discovery | Services select Pods by labels and expose a stable VIP | Kubernetes documentation |
⚠️ 使用说明与注意事项
- 本工具纯前端运行,数据不会上传到服务器
- 建议在主流浏览器(Chrome/Safari/Firefox/Edge)中使用
- 计算结果仅供参考,请以实际应用场景为准