Deployment
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)
部署期望行为的规范。
status (DeploymentStatus)
部署最近观察到的状态。
DeploymentSpec
DeploymentSpec 是部署期望行为的规范。
selector (LabelSelector), 必需
Pod 的标签选择器。被此选择器选中的现有 ReplicaSet 将受到此部署的影响。它必须与 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。
可能的枚举值
"Recreate"在创建新的 Pod 之前杀死所有现有的 Pod。"RollingUpdate"使用滚动更新(即逐渐缩减旧的 ReplicaSet 并缩放新的 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 的总数不超过期望 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)
具有 Ready 条件的此部署的目标非终止 Pod 的总数。
unavailableReplicas (int32)
此部署的目标不可用 Pod 的总数。这是部署要达到 100% 可用容量仍需要的 Pod 总数。它们可能是正在运行但尚未可用的 Pod,或者是尚未创建的 Pod。
updatedReplicas (int32)
此部署的目标非终止 Pod 的总数,这些 Pod 具有期望的模板规范。
terminatingReplicas (int32)
此部署的目标终止 Pod 的总数。终止 Pod 具有非空 .metadata.deletionTimestamp,并且尚未达到 .status.phase 的 Failed 或 Succeeded 状态。
这是一个 beta 字段,需要启用 DeploymentReplicaSetTerminatingReplicas 特性(默认启用)。
collisionCount (int32)
部署的哈希冲突计数。部署控制器使用此字段作为冲突避免机制,当它需要为最新的 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
DeploymentList 是 Deployments 的列表。
apiVersion: apps/v1
kind: DeploymentList
metadata (ListMeta)
标准列表元数据。
items ([]Deployment), required
Items 是 Deployments 的列表。
操作
get 读取指定的 Deployment
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
Parameters
响应
200 (Deployment): OK
401: 未授权
get 读取指定 Deployment 的状态
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
Parameters
响应
200 (Deployment): OK
401: 未授权
list 列出或监视 Deployment 类型的对象
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments
Parameters
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): OK
401: 未授权
list 列出或监视 Deployment 类型的对象
HTTP 请求
GET /apis/apps/v1/deployments
Parameters
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): OK
401: 未授权
create 创建 Deployment
HTTP 请求
POST /apis/apps/v1/namespaces/{namespace}/deployments
Parameters
namespace (在路径中): string, 必需
body: Deployment, required
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
202 (Deployment): Accepted
401: 未授权
update 替换指定的 Deployment
HTTP 请求
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}
Parameters
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: Deployment, required
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: 未授权
update 替换指定 Deployment 的状态
HTTP 请求
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
Parameters
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: Deployment, required
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: 未授权
patch 部分更新指定的 Deployment
HTTP 请求
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}
Parameters
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: Patch, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (in query): boolean
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: 未授权
patch 部分更新指定 Deployment 的状态
HTTP 请求
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
Parameters
name (在路径中): string, 必需
Deployment 的名称
namespace (在路径中): string, 必需
body: Patch, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (in query): boolean
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: 未授权
delete 删除 Deployment
HTTP 请求
DELETE /apis/apps/v1/namespaces/{namespace}/deployments/{name}
Parameters
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 集合
HTTP 请求
DELETE /apis/apps/v1/namespaces/{namespace}/deployments
Parameters
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 项目的其他地方进行。