← 返回命令列表

Linux command

kubectl-edit 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Edit deployment in editor

kubectl edit deployment [name]

Edit pod

kubectl edit pod [pod-name]

Edit with specific editor

EDITOR=nano kubectl edit deployment [name]

Edit resource in YAML format

kubectl edit deployment [name] -o yaml

说明

kubectl edit opens a resource's configuration in your default editor. Changes are applied when you save and exit. The resource is validated before applying. Set EDITOR or KUBE_EDITOR environment variable to change the editor.

参数

-o, --output _format_
Edit format (yaml, json).
-n, --namespace _name_
Kubernetes namespace.
--record
Record command in resource annotation.

FAQ

What is the kubectl-edit command used for?

kubectl edit opens a resource's configuration in your default editor. Changes are applied when you save and exit. The resource is validated before applying. Set EDITOR or KUBE_EDITOR environment variable to change the editor.

How do I run a basic kubectl-edit example?

Run `kubectl edit deployment [name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -o, --output _format_ do in kubectl-edit?

Edit format (yaml, json).