跳转到主要内容
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

请将尖括号内的内容替换为你自己的实际值。所有命令均来自官方文档,示例均在标明版本上实测运行。