部署
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)
Deployment 的期望行为规范。
status (DeploymentStatus)
Deployment 最近观察到的状态。
DeploymentSpec
DeploymentSpec 是 Deployment 的期望行为规范。
selector (LabelSelector), 必填
Pod 的标签选择器。现有 ReplicaSet 的 Pod 被此选择器选中,将受到此部署的影响。它必须与 Pod 模板的标签匹配。
template (PodTemplateSpec), 必填
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。
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 是 Deployment 最近观察到的状态。
replicas (int32)
此部署的目标未终止 Pod 的总数(它们的标签与选择器匹配)。
availableReplicas (int32)
此部署目标的可用 Pod 的总数(至少处于就绪状态 minReadySeconds)。
readyReplicas (int32)
readyReplicas 是此 Deployment 目标的具有就绪状态的 Pod 的数量。
unavailableReplicas (int32)
此部署目标的不可用 Pod 的总数。这是部署要具有 100% 可用容量仍需要的 Pod 的总数。它们可能是正在运行但尚未可用的 Pod,也可能是尚未创建的 Pod。
updatedReplicas (int32)
此部署目标的未终止 Pod 的总数,这些 Pod 具有期望的模板规范。
collisionCount (int32)
Deployment 的哈希冲突计数。当部署控制器需要为最新 ReplicaSet 创建名称时,它使用此字段作为冲突避免机制。
conditions ([]DeploymentCondition)
修补策略:按键
type
合并表示部署当前状态的最新可用观察结果。
DeploymentCondition 描述了在某个时间点部署的状态。
conditions.status (string), 必填
条件的状态,可以是 True、False 或 Unknown 之一。
conditions.type (string), 必填
部署条件的类型。
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 是 Deployment 的列表。
apiVersion: apps/v1
kind: DeploymentList
metadata (ListMeta)
标准列表元数据。
items ([]Deployment), 必填
Items 是 Deployment 的列表。
操作
get
读取指定的 Deployment
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
参数
响应
200 (Deployment): OK
401: Unauthorized
get
读取指定 Deployment 的状态
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
参数
响应
200 (Deployment): OK
401: Unauthorized
list
列出或观察 Deployment 类型的对象
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/deployments
参数
namespace (在路径中): string, 必填
allowWatchBookmarks (在查询中): boolean
continue (在查询中): string
fieldSelector (在查询中): string
labelSelector (在查询中): string
limit (在查询中): integer
pretty (在查询中): string
resourceVersion (在查询中): string
resourceVersionMatch (在查询中): string
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
watch (在查询中): boolean
响应
200 (DeploymentList): OK
401: Unauthorized
list
列出或观察 Deployment 类型的对象
HTTP 请求
GET /apis/apps/v1/deployments
参数
allowWatchBookmarks (在查询中): boolean
continue (在查询中): string
fieldSelector (在查询中): string
labelSelector (在查询中): string
limit (在查询中): integer
pretty (在查询中): string
resourceVersion (在查询中): string
resourceVersionMatch (在查询中): string
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
watch (在查询中): boolean
响应
200 (DeploymentList): OK
401: Unauthorized
create
创建 Deployment
HTTP 请求
POST /apis/apps/v1/namespaces/{namespace}/deployments
参数
namespace (在路径中): string, 必填
body: Deployment, 必填
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
202 (Deployment): Accepted
401: Unauthorized
update
替换指定的 Deployment
HTTP 请求
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}
参数
name (在路径中): string, 必填
Deployment 的名称
namespace (在路径中): string, 必填
body: Deployment, 必填
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
update
替换指定 Deployment 的状态
HTTP 请求
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): OK
201 (Deployment): Created
401: Unauthorized
patch
部分更新指定的 Deployment
HTTP 请求
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}
参数
name (在路径中): string, 必填
Deployment 的名称
namespace (在路径中): string, 必填
body: Patch, 必填
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (在查询中): boolean
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
patch
部分更新指定 Deployment 的状态
HTTP 请求
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
参数
name (在路径中): string, 必填
Deployment 的名称
namespace (在路径中): string, 必填
body: Patch, 必填
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (在查询中): boolean
pretty (在查询中): string
响应
200 (Deployment): OK
201 (Deployment): Created
401: Unauthorized
delete
删除 Deployment
HTTP 请求
DELETE /apis/apps/v1/namespaces/{namespace}/deployments/{name}
参数
name (在路径中): string, 必填
Deployment 的名称
namespace (在路径中): string, 必填
body: DeleteOptions
dryRun (在查询中): string
gracePeriodSeconds (在查询中): integer
pretty (在查询中): string
propagationPolicy (在查询中): string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 Deployment 集合
HTTP 请求
DELETE /apis/apps/v1/namespaces/{namespace}/deployments
参数
namespace (在路径中): string, 必填
body: DeleteOptions
continue (在查询中): string
dryRun (在查询中): string
fieldSelector (在查询中): string
gracePeriodSeconds (在查询中): integer
labelSelector (在查询中): string
limit (在查询中): integer
pretty (在查询中): string
propagationPolicy (在查询中): string
resourceVersion (在查询中): string
resourceVersionMatch (在查询中): string
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
响应
200 (Status): OK
401: Unauthorized
此页面是自动生成的。
如果您打算报告此页面出现问题,请在您的问题描述中提到该页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。