apiVersion: apps/v1
import "k8s.io/api/apps/v1"
Deployment 支持对 Pod 和 ReplicaSet 的声明式更新。
apiVersion: apps/v1
kind: Deployment
metadata (ObjectMeta)
标准对象的元数据。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec (DeploymentSpec)
Deployment 的期望行为规范。
status (DeploymentStatus)
Deployment 最近观察到的状态。
DeploymentSpec 是 Deployment 期望行为的规范。
selector (LabelSelector), 必需
Pod 的标签选择器。其 Pod 被此选择器选中的现有 ReplicaSet 将受到此部署的影响。它必须与 Pod 模板的标签匹配。
template (PodTemplateSpec), required
Template(模板)描述了将要创建的 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。
可能的枚举值
"Recreate" 在创建新 Pod 之前终止所有现有 Pod。"RollingUpdate" 使用滚动更新替换旧的 ReplicaSet,即逐步缩小旧的 ReplicaSet 并扩大新的 ReplicaSet。strategy.rollingUpdate (RollingUpdateDeployment)
滚动更新配置参数。仅在 DeploymentStrategyType = RollingUpdate 时存在。
strategy.rollingUpdate.maxSurge (IntOrString)
可以在期望的 Pod 数之上安排的最大 Pod 数。该值可以是绝对数字(例如:5)或期望 Pod 数的百分比(例如:10%)。如果 MaxUnavailable 为 0,则此值不能为 0。绝对数字通过百分比向上取整计算得出。默认为 25%。示例:当设置为 30% 时,新 ReplicaSet 在滚动更新开始时可以立即扩容,使得新旧 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 原因的状况(Condition)。请注意,当部署暂停时,不会估计进度。默认为 600 秒。
paused (boolean)
指示部署已暂停。
DeploymentStatus 是 Deployment 最近观察到的状态。
replicas (int32)
此部署所针对的非终止 Pod 的总数(它们的标签与选择器匹配)。
availableReplicas (int32)
此部署所针对的可用非终止 Pod(准备时间至少达到 minReadySeconds)的总数。
readyReplicas (int32)
此部署所针对的具有 Ready 条件的非终止 Pod 的总数。
unavailableReplicas (int32)
此部署所针对的不可用 Pod 的总数。这是部署达到 100% 可用容量所需的 Pod 总数。它们可能是正在运行但尚未可用的 Pod,或者是尚未创建的 Pod。
updatedReplicas (int32)
此部署所针对的、具有所需模板规范的非终止 Pod 的总数。
terminatingReplicas (int32)
此部署所针对的正在终止的 Pod 总数。正在终止的 Pod 具有非 null 的 .metadata.deletionTimestamp,且尚未达到 Failed 或 Succeeded 的 .status.phase。
这是一个 beta 字段,需要启用 DeploymentReplicaSetTerminatingReplicas 特性(默认启用)。
collisionCount (int32)
Deployment 的哈希冲突计数。当 Deployment 控制器需要为最新的 ReplicaSet 创建名称时,会将此字段用作避免冲突的机制。
conditions ([]DeploymentCondition)
Patch 策略:在键 type 上合并
映射:在合并期间将保留键类型上的唯一值
表示部署当前状态的最新可用观察结果。
DeploymentCondition 描述了部署在某个时间点的状态。
conditions.status (string), required
条件的状态,为 True、False 或 Unknown 之一。
conditions.type (string), required
部署状况的类型。
conditions.lastTransitionTime (Time)
条件从一个状态过渡到另一个状态的最后时间。
Time 是 time.Time 的包装器,支持正确地编组到 YAML 和 JSON。为时间包提供的许多工厂方法提供包装器。
conditions.lastUpdateTime (Time)
上次更新此状况的时间。
Time 是 time.Time 的包装器,支持正确地编组到 YAML 和 JSON。为时间包提供的许多工厂方法提供包装器。
conditions.message (string)
指示过渡细节的人类可读消息。
conditions.reason (string)
条件最后一次过渡的原因。
observedGeneration (int64)
部署控制器观察到的生成版本。
DeploymentList 是 Deployment 的列表。
apiVersion: apps/v1
kind: DeploymentList
metadata (ListMeta)
标准列表元数据。
items ([]Deployment), 必需
Items 是 Deployment 的列表。
get 读取指定的 DeploymentGET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
200 (Deployment): 成功
401: 未授权
get 读取指定 Deployment 的状态GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
200 (Deployment): 成功
401: 未授权
list 列出或监视 Deployment 类型的对象GET /apis/apps/v1/namespaces/{namespace}/deployments
namespace (在路径中): string, 必需
allowWatchBookmarks (in query): boolean
continue (in query): string
fieldSelector (in query): string
labelSelector (in query): string
limit (in query): integer
pretty (在查询中): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
200 (DeploymentList): 成功
401: 未授权
list 列出或监视 Deployment 类型的对象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 (在查询中): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
200 (DeploymentList): 成功
401: 未授权
create 创建 DeploymentPOST /apis/apps/v1/namespaces/{namespace}/deployments
namespace (在路径中): string, 必需
body: Deployment, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
200 (Deployment): 成功
201 (Deployment): 已创建
202 (Deployment): 已接受
401: 未授权
update 替换指定的 DeploymentPUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: Deployment, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
200 (Deployment): 成功
201 (Deployment): 已创建
401: 未授权
update 替换指定 Deployment 的状态PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: Deployment, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
200 (Deployment): 成功
201 (Deployment): 已创建
401: 未授权
patch 部分更新指定的 DeploymentPATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: Patch, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (in query): boolean
pretty (在查询中): string
200 (Deployment): 成功
201 (Deployment): 已创建
401: 未授权
patch 部分更新指定 Deployment 的状态PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: Patch, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (in query): boolean
pretty (在查询中): string
200 (Deployment): 成功
201 (Deployment): 已创建
401: 未授权
delete 删除 DeploymentDELETE /apis/apps/v1/namespaces/{namespace}/deployments/{name}
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: DeleteOptions
dryRun (在查询中): string
gracePeriodSeconds (in query): integer
ignoreStoreReadErrorWithClusterBreakingPotential (in query): boolean
pretty (在查询中): string
propagationPolicy (in query): string
200 (Status): 确定
202 (Status): 已接受
401: 未授权
deletecollection 删除 Deployment 集合DELETE /apis/apps/v1/namespaces/{namespace}/deployments
namespace (在路径中): string, 必需
body: DeleteOptions
continue (in query): string
dryRun (在查询中): string
fieldSelector (in query): string
gracePeriodSeconds (in query): integer
ignoreStoreReadErrorWithClusterBreakingPotential (in query): boolean
labelSelector (in query): string
limit (in query): integer
pretty (在查询中): string
propagationPolicy (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
200 (Status): 确定
401: 未授权
本页面是自动生成的。
如果您打算报告此页面的问题,请在您的问题描述中提及该页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。