跳至主要內容
kitlocal.dev

kubectl 指令速查表

本機執行

100% 在你的瀏覽器中處理。輸入與輸出絕不會離開你的裝置。

適用於 Kubernetes 1.30+ 的 Kubernetes CLI 指令:檢查 Pod、Deployment、Service、日誌、exec 偵錯、滾動發布、Context 與 JSONPath 查詢。

運作原理

kubectl reads and reconciles declarative resource manifests against the API server: `get`/`describe`/`logs` diagnose state, while `apply`/`rollout` safely drive cluster changes.

生存指南

最先需要掌握的少數核心指令。

42 個指令

鍵盤快捷鍵/聚焦搜尋列JK移動選取項目C複製選取的指令F將選取項目加入或移除書籤Esc清除搜尋

Contexts, Namespaces & Discovery

Verify which cluster and namespace you target before reading or changing state.

  • 必備

    Print the currently active cluster context before running commands

    kubectl config current-context

    使用時機

    Prevents accidentally running dev commands against a production cluster.

    範例

    kubectl config current-context

Inspect, Logs & Events

Diagnose CrashLoopBackOff, ImagePullBackOff, pending pods, and probe failures.

Shell, Port-Forward & Copy

Connect to cluster services locally, exec into pods, and transfer files.

Apply, Dry-Run & Rollouts

Validate manifests safely, watch rollouts, scale, and roll back cleanly.

Nodes, RBAC & Cleanup

Verify permissions, check resource usage, cordon nodes, and clean pods.

在 KitLocal 工具中試用

已於 2026年11月15日 驗證 · 已對照 Kubernetes 1.30+ kubectl CLI 驗證

資料來源: Kubernetes kubectl Reference · kubectl Quick Reference

請將尖括號內的任何內容替換為你自己的數值。指令均源自官方文件,且範例均在所示版本上實際執行。