kubectl是否适用于kubectl创建? [英] kubectl apply vs kubectl create?

查看:103
本文介绍了kubectl是否适用于kubectl创建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从文档中了解到的是:

What I understood by the documentation is that:

  • kubectl create =在集群中创建新的k8s资源
  • kubectl replace =更新活动集群中的资源
  • kubectl适用 =如果我想创建+替换( 参考 )
  • kubectl create = Creates a new k8s resource in the cluster
  • kubectl replace = Updates a resource in the live cluster
  • kubectl apply = If I want to do create + replace (Reference)

我的问题是

  1. 为什么在集群中有三个用于执行相同任务的操作?
  2. 这些操作的用例是什么?
  3. 它们在引擎盖下有何不同?

推荐答案

这是两种不同的方法:

kubectl create是我们所说的必须管理.通过这种方法,您告诉Kubernetes API您要创建,替换或删除的内容,而不是您希望K8s群集世界的外观.

kubectl create is what we call Imperative Management. On this approach you tell the Kubernetes API what you want to create, replace or delete, not how you want your K8s cluster world to look like.

kubectl apply声明性声明的一部分管理方法,即使您apply对对象进行了其他更改,您可能已对活动对象(即通过scale进行的更改)也将得到"维护". >

kubectl apply is part of the Declarative Management approach, where changes that you may have applied to a live object (i.e. through scale) are "maintained" even if you apply other changes to the object.

您可以在 Kubernetes对象管理文档.

这篇关于kubectl是否适用于kubectl创建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆