☸️ 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)中使用
- 計算結果僅供參考,請以實際應用場景為準