Files
docker_practice/13_kubernetes_setup/kubectl.md
Baohua Yang 175aaae48a style(docs): standardize heading formats and numbering
- Enforce Level 1-3 structural numbering based on SUMMARY.md hierarchy
- Remove structural numbering from Level 4+ headings
- Eliminate single child headings by converting to bold text
- Auto-inject summary text for headings with multiple children missing intro text
- Exclude Appendix chapters from structural numbering
- Avoid modifying code block contents
- Add script to detect non-standard English usage in headers
2026-02-21 22:40:33 -08:00

1.2 KiB

kubectl 使用

kubectl 是 Kubernetes 自带的客户端,可以用它来直接操作 Kubernetes。

使用格式有两种:

kubectl [flags]
kubectl [command]

13.8 get

显示一个或多个资源

13.8 describe

显示资源详情

13.8 create

从文件或标准输入创建资源

13.8 update

从文件或标准输入更新资源

13.8 delete

通过文件名、标准输入、资源名或者 label selector 删除资源

13.8 logs

输出 pod 中一个容器的日志

13.8 rollout

对 Deployment 等资源执行滚动更新/回滚

13.8 exec

在容器内部执行命令

13.8 port-forward

将本地端口转发到 Pod

13.8 proxy

为 Kubernetes API server 启动代理服务器

13.8 run

在集群中使用指定镜像启动容器

13.8 expose

将 replication controller service 或 pod 暴露为新的 Kubernetes service

13.8 label

更新资源的 label

13.8 config

修改 Kubernetes 配置文件

13.8 cluster-info

显示集群信息

13.8 api-versions

以 “组/版本” 的格式输出服务端支持的 API 版本

13.8 version

输出服务端和客户端的版本信息

13.8 help

显示各个命令的帮助信息