容器编排技术 -- Kubernetes kubectl edit 命令详解

  • 1 kubectl edit
  • 2 语法
  • 3 示例
  • 4 Flags

kubectl edit

使用默认编辑器 编辑服务器上定义的资源。

使用命令行工具获取的任何资源都可以使用edit命令编辑。edit命令会打开使用KUBE_EDITOR,GIT_EDITOR 或者EDITOR环境变量定义的编辑器,可以同时编辑多个资源,但所编辑过的资源只会一次性提交。edit除命令参数外还接受文件名形式。

文件默认输出格式为YAML。要以JSON格式编辑,请指定“-o json”选项。

如果在更新资源时报错,将会在磁盘上创建一个临时文件来记录。在更新资源时最常见的错误是几个用户同时使用编辑器更改服务器上资源,发生这种情况,你需要将你的更改应用到最新版本的资源上,或者更新保存的临时副本。

语法

$ edit (RESOURCE/NAME | -f FILENAME)

示例

编辑名为'docker-registry'的service:

kubectl edit svc/docker-registry

使用替代的编辑器

KUBE_EDITOR="nano" kubectl edit svc/docker-registry

编辑名为“myjob”的service,输出JSON格式 V1 API版本

kubectl edit job.v1.batch/myjob -o json

以YAML格式输出编辑deployment“mydeployment”,并将修改的配置保存在annotation中:

kubectl edit deployment/mydeployment -o yaml --save-config

Flags

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|json.
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

容器编排技术 -- Kubernetes kubectl edit 命令详解相关推荐

  1. 容器编排技术 -- Kubernetes kubectl create 命令详解

    容器编排技术 -- Kubernetes kubectl create 命令详解 1 kubectl create 2 语法 3 示例 4 Flags kubectl create 通过配置文件名或s ...

  2. 容器编排技术 -- Kubernetes kubectl scale 命令详解

    容器编排技术 -- Kubernetes kubectl scale 命令详解 1 kubectl scale 2 语法 3 示例 4 Flags kubectl scale 扩容或缩容 Deploy ...

  3. 容器编排技术 -- Kubernetes kubectl rolling-update 命令详解

    容器编排技术 -- Kubernetes kubectl rolling-update 命令详解 1 kubectl rolling-update 2 语法 3 示例 4 Flags kubectl ...

  4. 容器编排技术 -- Kubernetes kubectl replace 命令详解

    容器编排技术 -- Kubernetes kubectl replace 命令详解 1 kubectl replace 2 语法 3 示例 4 Flags kubectl replace 使用配置文件 ...

  5. 容器编排技术 -- Kubernetes kubectl patch 命令详解

    容器编排技术 -- Kubernetes kubectl patch 命令详解 1 kubectl patch 2 语法 3 示例 4 Flags kubectl patch 使用(patch)补丁修 ...

  6. 容器编排技术 -- Kubernetes kubectl label 命令详解

    容器编排技术 -- Kubernetes kubectl label 命令详解 1 kubectl label 2 语法 3 示例 4 Flags kubectl label 更新(增加.修改或删除) ...

  7. 容器编排技术 -- Kubernetes kubectl get 命令详解

    容器编排技术 -- Kubernetes kubectl get 命令详解 1 kubectl get 2 语法 3 示例 4 Flags kubectl get 获取列出一个或多个资源的信息. 可以 ...

  8. 容器编排技术 -- Kubernetes kubectl delete 命令详解

    容器编排技术 -- Kubernetes kubectl delete 命令详解 1 kubectl delete 2 语法 3 示例 4 Flags kubectl delete 通过配置文件名.s ...

  9. 容器编排技术  - Kubernetes kubectl convert 命令详解

    容器编排技术  - Kubernetes kubectl convert 命令详解 1 kubectl convert 2 语法 3 示例 4 Flags kubectl convert 转换配置文件 ...

最新文章

  1. Github标星9k+,超赞的 PyTorch 中文资源大列表!
  2. Django运行报错Invalid HTTP_HOST header: ‘0.0.0.0:8000‘. You may need to add ‘0.0.0.0‘ to ALLOWED_HOSTS.
  3. jQuery快速学习
  4. SpringBoot笔记:SpringBoot启动参数配置
  5. 问题战略[置顶] 十八年开发经验分享(四)问题解决篇(下)
  6. wamp下Apache2.4.x局域网访问403的解决办法
  7. Spring底层控制反转解耦合(IOC)
  8. Liunx 重定向,管道符(转)
  9. linux菜鸟要飞-根目录
  10. Android学习笔记之如何将数据保存到SDCard
  11. PMP考试难度以及通过率
  12. 微星主板怎么开启CPU虚拟化技术VT-X(intel和AMD)
  13. 汉字编码对照表(gb2312/Big5/GB2312)
  14. QT学习笔记(一)——QT基础
  15. 永洪bi logo更换
  16. python软件工程师认证证书报考条件_软件工程师怎么考 报考条件是什么
  17. 用js超简单判断图片地址是否存在(404问题)
  18. 理解物理 CPU 与逻辑 CPU
  19. linux 使用 nginx 搭建 zookeeper 集群
  20. 乐游TGapi接口平台(接口商)

热门文章

  1. C#的多线程机制探索6
  2. Node.js:入门资料
  3. 使用新的 apt 命令在 Ubuntu 16.04 LTS 下管理软件包
  4. 网页检测 AdBlock 的 6 种方法
  5. ckeditor3 配置
  6. Python_sklearn_回归
  7. SLAM方向公众号、知乎、博客学习参考
  8. 【今日CV 视觉论文速览】30 Nov 2018
  9. Echarts 地理信息可视化:基于地图显示坐标点信息
  10. Kafka—topic的查询和创建