k8s kubectl edit
k8s kubectl edit
1.1 使用语法
1.1.1 json格式编辑
编辑名为“myjob”的service,输出JSON格式 V1 API版本
kubectl edit job.v1.batch/myjob -o json
1.1.2 yml格式编辑
以YAML格式输出编辑liwench22042601 命名空间下的用deployment部署的redis
rancher kubectl edit deployment/redis -n liwench22042601 -o yaml --save-config
或者
#这里的 deployment.apps固定写死的
kubectl edit deployment.apps redis -n ecs-micro-first -o yaml --save-config
2.1 其他参数
Name | Shorthand | Default | Usage |
---|---|---|---|
filename | f | [] | Filename, directory, or URL to files to use to edit the resource |
include-extended-apis | true | If true, include definitions of new APIs via calls to the API server. [default true] | |
output | o | yaml | Output format. One of: yaml |
record | false | Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists. | |
recursive | R | false | Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory. |
save-config | false | If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future. | |
schema-cache-dir | ~/.kube/schema | If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema' | |
validate | true | If true, use a schema to validate the input before sending it | |
windows-line-endings | false | Use Windows line-ending |