部署
apiVersion: apps/v1
import "k8s.io/api/apps/v1"
部署
部署为 Pod 和 ReplicaSet 提供声明式更新。
apiVersion: apps/v1
kind: Deployment
metadata (ObjectMeta)
标准对象的元数据。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec (DeploymentSpec)
部署的期望行为规范。
status (DeploymentStatus)
部署的最新观察到的状态。
DeploymentSpec
DeploymentSpec 是部署的期望行为规范。
selector (LabelSelector), required
Pod 的标签选择器。受此部署影响的现有 ReplicaSet 将是其 Pod 被此选择器选中的那些。它必须与 Pod 模板的标签匹配。
template (PodTemplateSpec), required
模板描述将要创建的 Pod。唯一允许的 template.spec.restartPolicy 值是“Always”。
replicas (int32)
期望的 Pod 数量。这是一个指针,用于区分显式零和未指定。默认为 1。
minReadySeconds (int32)
新创建的 Pod 应该在没有其任何容器崩溃的情况下处于就绪状态的最小秒数,以便它被认为是可用的。默认为 0(Pod 一旦就绪就会被认为是可用的)。
strategy (DeploymentStrategy)
补丁策略:retainKeys
用于用新 Pod 替换现有 Pod 的部署策略。
DeploymentStrategy 描述了如何用新 Pod 替换现有 Pod。
strategy.type (string)
部署类型。可以是“Recreate”或“RollingUpdate”。默认为 RollingUpdate。
strategy.rollingUpdate (RollingUpdateDeployment)
滚动更新配置参数。仅在 DeploymentStrategyType = RollingUpdate 时存在。
strategy.rollingUpdate.maxSurge (IntOrString)
可以安排的超过期望 Pod 数量的 Pod 的最大数量。值可以是绝对数量(例如:5)或期望 Pod 的百分比(例如:10%)。如果 MaxUnavailable 为 0,则此值不能为 0。绝对数量是通过向上取整从百分比计算的。默认为 25%。例如:当此值设置为 30% 时,新的 ReplicaSet 可以立即在滚动更新开始时进行扩展,这样旧 Pod 和新 Pod 的总数不会超过期望 Pod 的 130%。一旦旧 Pod 被杀死,新的 ReplicaSet 可以进一步扩展,确保在更新期间任何时间运行的 Pod 总数最多为期望 Pod 的 130%。
IntOrString 是一种可以保存 int32 或字符串的类型。在 JSON 或 YAML 序列化和反序列化时,它会生成或使用内部类型。这允许您拥有例如一个可以接受名称或数字的 JSON 字段。
strategy.rollingUpdate.maxUnavailable (IntOrString)
在更新期间可能不可用的 Pod 的最大数量。值可以是绝对数量(例如:5)或期望 Pod 的百分比(例如:10%)。绝对数量是通过向下取整从百分比计算的。如果 MaxSurge 为 0,则此值不能为 0。默认为 25%。例如:当此值设置为 30% 时,旧的 ReplicaSet 可以立即在滚动更新开始时缩减到期望 Pod 的 70%。一旦新 Pod 就绪,旧的 ReplicaSet 可以进一步缩减,然后扩展新的 ReplicaSet,确保在更新期间始终可用的 Pod 总数至少为期望 Pod 的 70%。
IntOrString 是一种可以保存 int32 或字符串的类型。在 JSON 或 YAML 序列化和反序列化时,它会生成或使用内部类型。这允许您拥有例如一个可以接受名称或数字的 JSON 字段。
revisionHistoryLimit (int32)
要保留的旧 ReplicaSet 的数量,以允许回滚。这是一个指针,用于区分显式零和未指定。默认为 10。
progressDeadlineSeconds (int32)
部署在被认为失败之前可以取得进展的最大时间(以秒为单位)。部署控制器将继续处理失败的部署,并且将在部署状态中显示带有 ProgressDeadlineExceeded 原因的条件。请注意,在部署暂停期间不会估计进度。默认为 600 秒。
paused (boolean)
指示部署是否暂停。
DeploymentStatus
DeploymentStatus 是部署的最新观察到的状态。
replicas (int32)
此部署目标的未终止 Pod 的总数(它们的标签与选择器匹配)。
availableReplicas (int32)
此部署目标的可用 Pod 的总数(至少就绪 minReadySeconds)。
readyReplicas (int32)
readyReplicas 是此部署目标的具有就绪条件的 Pod 的数量。
unavailableReplicas (int32)
此部署目标的不可用 Pod 的总数。这是部署要拥有 100% 可用容量仍然需要的 Pod 的总数。它们可能是正在运行但尚未可用的 Pod,也可能是尚未创建的 Pod。
updatedReplicas (int32)
此部署目标的具有期望模板规范的未终止 Pod 的总数。
collisionCount (int32)
部署的哈希冲突计数。部署控制器使用此字段作为冲突避免机制,当它需要为最新的 ReplicaSet 创建名称时。
conditions ([]DeploymentCondition)
补丁策略:根据键
type
合并表示部署当前状态的最新可用观察结果。
DeploymentCondition 描述了部署在某一时刻的状态。
conditions.status (string), required
条件的状态,可以是 True、False 或 Unknown 之一。
conditions.type (string), required
部署条件的类型。
conditions.lastTransitionTime (Time)
条件从一种状态转换为另一种状态的最后时间。
Time 是 time.Time 的包装器,它支持对 YAML 和 JSON 的正确序列化。包装器是为 time 包提供的许多工厂方法提供的。
conditions.lastUpdateTime (Time)
此条件最后一次更新的时间。
Time 是 time.Time 的包装器,它支持对 YAML 和 JSON 的正确序列化。包装器是为 time 包提供的许多工厂方法提供的。
conditions.message (string)
一个可读的文本消息,指示有关转换的详细信息。
conditions.reason (string)
条件最后一次转换的原因。
observedGeneration (int64)
部署控制器观察到的代。
DeploymentList
DeploymentList 是部署列表。
apiVersion: apps/v1
kind: DeploymentList
metadata (ListMeta)
标准列表元数据。
items ([]Deployment), required
Items 是部署列表。
操作
get
读取指定的部署
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
参数
name (in path): string, required
部署的名称
namespace (in path): string, required
pretty (in query): string
响应
200 (Deployment): OK
401: Unauthorized
get
读取指定部署的状态
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
参数
name (in path): string, required
部署的名称
namespace (in path): string, required
pretty (in query): string
响应
200 (Deployment): OK
401: Unauthorized
list
列出或观察 Deployment 类型的对象
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments
参数
namespace (in path): string, required
allowWatchBookmarks (in query): boolean
continue (in query): string
fieldSelector (in query): string
labelSelector (in query): string
limit (in query): integer
pretty (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
响应
200 (DeploymentList): OK
401: Unauthorized
list
列出或观察 Deployment 类型的对象
HTTP 请求
GET /apis/apps/v1/deployments
参数
allowWatchBookmarks (in query): boolean
continue (in query): string
fieldSelector (in query): string
labelSelector (in query): string
limit (in query): integer
pretty (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
响应
200 (DeploymentList): OK
401: Unauthorized
create
创建一个部署
HTTP 请求
POST /apis/apps/v1/namespaces/{namespace}/deployments
参数
namespace (in path): string, required
body: Deployment, required
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
pretty (in query): string
响应
200 (Deployment): OK
201 (Deployment): Created
202 (Deployment): Accepted
401: Unauthorized
update
替换指定的部署
HTTP 请求
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}
参数
name (in path): string, required
部署的名称
namespace (in path): string, required
body: Deployment, required
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
pretty (in query): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
update
替换指定部署的状态
HTTP 请求
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
参数
name (in path): string, required
部署的名称
namespace (in path): string, required
body: Deployment, required
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
pretty (in query): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
patch
部分更新指定的部署
HTTP 请求
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}
参数
name (in path): string, required
部署的名称
namespace (in path): string, required
body: Patch, required
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
force (in query): boolean
pretty (in query): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
patch
部分更新指定部署的状态
HTTP 请求
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
参数
name (in path): string, required
部署的名称
namespace (in path): string, required
body: Patch, required
dryRun (in query): string
fieldManager (in query): string
fieldValidation (in query): string
force (in query): boolean
pretty (in query): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
delete
删除一个部署
HTTP 请求
DELETE /apis/apps/v1/namespaces/{namespace}/deployments/{name}
参数
name (in path): string, required
部署的名称
namespace (in path): string, required
body: DeleteOptions
dryRun (in query): string
gracePeriodSeconds (in query): integer
pretty (in query): string
propagationPolicy (in query): string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 Deployment 集合
HTTP 请求
DELETE /apis/apps/v1/namespaces/{namespace}/deployments
参数
namespace (in path): string, required
body: DeleteOptions
continue (in query): string
dryRun (in query): string
fieldSelector (in query): string
gracePeriodSeconds (in query): integer
labelSelector (in query): string
limit (in query): integer
pretty (in query): string
propagationPolicy (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
响应
200 (Status): OK
401: Unauthorized
此页面是自动生成的。
如果您要报告此页面的问题,请在您的问题描述中提及该页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。