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 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!