diff --git a/content/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1.md b/content/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1.md new file mode 100644 index 0000000000..38b246f7ea --- /dev/null +++ b/content/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1.md @@ -0,0 +1,1600 @@ +--- +api_metadata: + apiVersion: "apps/v1" + import: "k8s.io/api/apps/v1" + kind: "DaemonSet" +content_type: "api_reference" +description: "DaemonSet 表示守护程序集的配置。" +title: "DaemonSet" +weight: 8 +--- + + + + +`apiVersion: apps/v1` + +`import "k8s.io/api/apps/v1"` + + +## DaemonSet {#DaemonSet} + +DaemonSet 表示守护程序集的配置。 + +
+ +- **apiVersion**: apps/v1 + + +- **kind**: DaemonSet + + +- **metadata** (}}">ObjectMeta) + + 标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + + +- **spec** (}}">DaemonSetSpec) + + 此守护程序集的预期行为。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + + +- **status** (}}">DaemonSetStatus) + + 此守护程序集的当前状态。此数据可能已经过时一段时间。由系统填充。 + 只读。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + + + +## DaemonSetSpec {#DaemonSetSpec} + +DaemonSetSpec 是守护程序集的规约。 + +
+ + +- **selector** (}}">LabelSelector), 必需 + + 对由守护程序集管理的 Pod 的标签查询。Pod 必须匹配此查询才能被此 DaemonSet 控制。 + 查询条件必须与 Pod 模板的标签匹配。 + 更多信息: https://kubernetes.io/zh-cn/concepts/overview/working-with-objects/labels/#label-selectors + + +- **template** (}}">PodTemplateSpec), 必需 + + 描述将要创建的 Pod 的对象。DaemonSet 将在与模板的节点选择器匹配的每个节点上 + (如果未指定节点选择器,则在每个节点上)准确创建此 Pod 的副本。 + 更多信息: https://kubernetes.io/zh-cn/concepts/workloads/controllers/replicationcontroller#pod-template + + +- **minReadySeconds** (int32) + + 新建的 DaemonSet Pod 应该在没有任何容器崩溃的情况下处于就绪状态的最小秒数,这样它才会被认为是可用的。默认为 0(Pod 准备就绪后将被视为可用)。 + + +- **updateStrategy** (DaemonSetUpdateStrategy) + + 用新 Pod 替换现有 DaemonSet Pod 的更新策略。 + + + + **DaemonSetUpdateStrategy 是一个结构体,用于控制 DaemonSet 的更新策略。** + + + + - **updateStrategy.type** (string) + + 守护程序集更新的类型。可以是 "RollingUpdate" 或 "OnDelete"。默认为 RollingUpdate。 + + + + - **updateStrategy.rollingUpdate** (RollingUpdateDaemonSet) + + 滚动更新配置参数。仅在 type 值为 "RollingUpdate" 时出现。 + + + + **用于控制守护程序集滚动更新的预期行为的规约。** + + + + - **updateStrategy.rollingUpdate.maxSurge** (IntOrString) + + 对于拥有可用 DaemonSet Pod 的节点而言,在更新期间可以拥有更新后的 DaemonSet Pod 的最大节点数。 + 属性值可以是绝对数量(例如:5)或所需 Pod 的百分比(例如:10%)。 + 如果 maxUnavailable 为 0,则该值不能为 0。绝对数是通过四舍五入从百分比计算得出的,最小值为 1。 + 默认值为 0。示例:当设置为 30% 时,最多为节点总数的 30% 节点上应该运行守护程序 Pod(即 status.desiredNumberScheduled) + 可以在旧 Pod 标记为已删除之前创建一个新 Pod。更新首先在 30% 的节点上启动新的 Pod。 + 一旦更新的 Pod 可用(就绪时长至少 minReadySeconds 秒),该节点上的旧 DaemonSet pod 就会被标记为已删除。 + 如果旧 Pod 因任何原因变得不可用(Ready 转换为 false、被驱逐或节点被腾空), + 则会立即在该节点上创建更新的 Pod,而不考虑激增限制。 + 允许激增意味着如果就绪检查失败,任何给定节点上的守护程序集消耗的资源可能会翻倍, + 因此资源密集型守护程序集应该考虑到它们可能会在中断期间导致驱逐。 + 此字段是 Beta 字段,由 DaemonSetUpdateSurge 特性门启用/禁用。 + + + + **IntOrString 是一种可以容纳 int32 或字符串的类型。在 JSON 或 YAML 编组和解组中使用时,它会生成或使用内部类型。 + 例如,这允许你拥有一个可以接受名称或数字的 JSON 字段。** + + + + - **updateStrategy.rollingUpdate.maxUnavailable** (IntOrString) + + 更新期间不可用的 DaemonSet Pod 的最大数量。值可以是绝对数(例如:5)或更新开始时 DaemonSet Pod 总数的百分比(例如:10%)。 + 绝对数是通过四舍五入的百分比计算得出的。如果 maxSurge 为 0,则此值不能为 0 默认值为 1。 + 例如:当设置为 30% 时,最多节点总数 30% 的、应该运行守护程序的节点总数(即 status.desiredNumberScheduled) + 可以在任何给定时间停止更新。更新首先停止最多 30% 的 DaemonSet Pod, + 然后在它们的位置启动新的 DaemonSet Pod。 + 一旦新的 Pod 可用,它就会继续处理其他 DaemonSet Pod,从而确保在更新期间至少 70% 的原始 DaemonSet Pod 数量始终可用。 + + + + **IntOrString 是一种可以保存 int32 或字符串的类型。在 JSON 或 YAML 编组和解组中使用时,它会生成或使用内部类型。例如,这允许你拥有一个可以接受名称或数字的 JSON 字段。** + + +- **revisionHistoryLimit** (int32) + + 用来允许回滚而保留的旧历史记录的数量。此字段是个指针,用来区分明确的零值和未指定的指针。默认值是 10。 + + + +## DaemonSetStatus {#DaemonSetStatus} + +DaemonSetStatus 表示守护程进程的当前状态。 + +
+ + +- **numberReady** (int32),必需 + + numberReady 是应该运行守护进程 Pod 并且有一个或多个 DaemonSet Pod 以就绪条件运行的节点数。 + + +- **numberAvailable** (int32) + + 应该运行守护进程 Pod 并有一个或多个守护进程 Pod 正在运行和可用(就绪时长超过 spec.minReadySeconds)的节点数量。 + + +- **numberUnavailable** (int32) + + 应该运行守护进程 Pod 并且没有任何守护进程 Pod 正在运行且可用(至少已就绪 spec.minReadySeconds 秒)的节点数。 + + +- **numberMisscheduled** (int32),必需 + + 正在运行守护进程 Pod,但不应该运行守护进程 Pod 的节点数量。更多信息: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + + +- **desiredNumberScheduled** (int32),必需 + + 应该运行守护进程 Pod 的节点总数(包括正确运行守护进程 Pod 的节点)。更多信息: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + + +- **currentNumberScheduled** (int32),必需 + + 运行至少 1 个守护进程 Pod 并且应该运行守护进程 Pod 的节点数。多信息: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ + + +- **updatedNumberScheduled** (int32) + + 正在运行更新后的守护进程 Pod 的节点总数。 + + +- **collisionCount** (int32) + + DaemonSet 的哈希冲突计数。DaemonSet 控制器在需要为最新的 ControllerRevision 创建名称时使用此字段作为避免冲突的机制。 + + +- **conditions** ([]DaemonSetCondition) + + **补丁策略:根据 `type` 键合并** + + + 表示 DaemonSet 当前状态的最新可用观测信息。 + + + **DaemonSet Condition 描述了 DaemonSet 在某一时刻的状态。** + + + + - **conditions.status** (string),必需 + + 状况的状态,True、False、Unknown 之一。 + + - **conditions.type** (string),必需 + + DaemonSet 状况的类型。 + + + + - **conditions.lastTransitionTime** (Time) + + 状况上次从一种状态转换到另一种状态的时间。 + + + **Time 是对 time.Time 的封装,支持正确编码为 YAML 和 JSON。time 包为许多工厂方法提供了封装器。** + + + + - **conditions.message** (string) + + 一条人类可读的消息,指示有关转换的详细信息。 + + + + - **conditions.reason** (string) + + 状况最后一次转换的原因。 + + + +- **observedGeneration** (int64) + + 守护进程集控制器观察到的最新一代。 + + + + +## DaemonSetList {#DaemonSetList} + +DaemonSetList 是守护进程集的集合。 + +
+ +- **apiVersion**: apps/v1 + + +- **kind**: DaemonSetList + + + + +- **metadata** (}}">ListMeta) + + 标准列表元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + +- **items** ([]}}">DaemonSet), 必需 + + DaemonSet 的列表。 + + +## Operations {#Operations} + +
+ + +### `get` 读取指定的 DaemonSet + +#### HTTP 请求 + +GET /apis/apps/v1/namespaces/{namespace}/daemonsets/{name} + +#### 参数 + + +- **name** (**路径参数**): string, 必需 + + DaemonSet 的名称 + + + +- **namespace** (**路径参数**): string, 必需 + + }}">namespace + + +- **pretty** (**查询参数**): string + + }}">pretty + + +#### 响应 + + +200 (}}">DaemonSet): OK + +401: 未授权 + + +### `get` 读取指定的 DaemonSet 的状态 + +#### HTTP 请求 + +GET /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status + +#### 参数 + + +- **name** (**路径参数**): string, 必需 + + DaemonSet 的名称 + + +- **namespace** (**路径参数**): string, 必需 + + }}">namespace + + +- **pretty** (**查询参数**): string + + }}">pretty + + +#### 响应 + + +200 (}}">DaemonSet): OK + +401: 未授权 + + +### `list` 列表或查看 DaemonSet 类型的对象 + +#### HTTP 请求 + +GET /apis/apps/v1/namespaces/{namespace}/daemonsets + +#### 参数 + + + +- **namespace** (**路径参数**): string, 必需 + + }}">namespace + + + +- **allowWatchBookmarks** (**路径参数**): boolean + + }}">allowWatchBookmarks + + +- **continue** (**查询参数**): string + + }}">continue + + + +- **fieldSelector** (**查询参数**): string + + }}">fieldSelector + + +- **labelSelector** (**查询参数**): string + + }}">labelSelector + + + +- **limit** (**查询参数**): integer + + }}">limit + + +- **pretty** (**查询参数**): string + + }}">pretty + + + +- **resourceVersion** (**查询参数**): string + + }}">resourceVersion + + +- **resourceVersionMatch** (**查询参数**): string + + }}">resourceVersionMatch + + + +- **timeoutSeconds** (**查询参数**): integer + + }}">timeoutSeconds + + +- **watch** (**查询参数**): boolean + + }}">watch + + +#### 响应 + + +200 (}}">DaemonSetList): OK + +401: 未授权 + + +### `list` 列表或查看 DaemonSet 类型的对象 + +#### HTTP 请求 + +GET /apis/apps/v1/daemonsets + +#### 参数 + + + +- **allowWatchBookmarks** (**查询参数**): boolean + + }}">allowWatchBookmarks + + +- **continue** (**查询参数**): string + + }}">continue + + + +- **fieldSelector** (**查询参数**): string + + }}">fieldSelector + + +- **labelSelector** (**查询参数**): string + + }}">labelSelector + + + +- **limit** (**查询参数**): integer + + }}">limit + + +- **pretty** (**查询参数**): string + + }}">pretty + + + +- **resourceVersion** (**查询参数**): string + + }}">resourceVersion + + +- **resourceVersionMatch** (**查询参数**): string + + }}">resourceVersionMatch + + + +- **timeoutSeconds** (**查询参数**): integer + + }}">timeoutSeconds + + +- **watch** (**查询参数**): boolean + + }}">watch + + + +#### 响应 + + +200 (}}">DaemonSetList): OK + +401: 未授权 + + +### `create` 创建一个 DaemonSet + +#### HTTP 请求 + +POST /apis/apps/v1/namespaces/{namespace}/daemonsets + +#### 参数 + + +- **namespace** (**路径参数**): string, 必需 + + }}">namespace + + +- **body**: }}">DaemonSet, 必需 + + + +- **dryRun** (**查询参数**): string + + }}">dryRun + + +- **fieldManager** (**查询参数**): string + + }}">fieldManager + + + +- **fieldValidation** (**查询参数**): string + + }}">fieldValidation + + +- **pretty** (**查询参数**): string + + }}">pretty + + +#### 响应 + + +200 (}}">DaemonSet): OK + +201 (}}">DaemonSet): 创建完成 + +202 (}}">DaemonSet): 已接受 + +401: 未授权 + + +### `update` 替换指定的 DaemonSet + +#### HTTP 请求 + +PUT /apis/apps/v1/namespaces/{namespace}/daemonsets/{name} + +#### 参数 + + +- **name** (**路径参数**): string,必需 + + DaemonSet 的名称 + + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + + +- **body**: }}">DaemonSet,必需 + + + +- **dryRun** (**查询参数**): string + + }}">dryRun + + +- **fieldManager** (**查询参数**): string + + }}">fieldManager + + + +- **fieldValidation** (**查询参数**): string + + }}">fieldValidation + + +- **pretty** (**查询参数**): string + + }}">pretty + + +#### 响应 + + +200 (}}">DaemonSet): OK + +201 (}}">DaemonSet): 已创建 + +401: 未授权 + + +### `update` 替换指定 DaemonSet 的状态 + +#### HTTP 请求 + +PUT /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status + +#### 参数 + + +- **name** (**路径参数**): string, 必需 + + DaemonSet 的名称 + + +- **namespace** (**路径参数**): string, 必需 + + }}">namespace + + +- **body**: }}">DaemonSet, 必需 + + + +- **dryRun** (**查询参数**): string + + }}">dryRun + + +- **fieldManager** (**查询参数**): string + + }}">fieldManager + + + +- **fieldValidation** (**查询参数**): string + + }}">fieldValidation + + +- **pretty** (**查询参数**): string + + }}">pretty + + +#### 响应 + + +200 (}}">DaemonSet): OK + +201 (}}">DaemonSet): 已创建 + +401: 未授权 + + +### `patch` 部分更新指定的 DaemonSet + +#### HTTP 请求 + +PATCH /apis/apps/v1/namespaces/{namespace}/daemonsets/{name} + +#### 参数 + + + +- **name** (**路径参数**): string, 必需 + + DaemonSet 的名称 + + +- **namespace** (**路径参数**): string, 必需 + + }}">namespace + + +- **body**: }}">Patch, 必需 + + + +- **dryRun** (**查询参数**): string + + }}">dryRun + + +- **fieldManager** (**查询参数**): string + + }}">fieldManager + + + +- **fieldValidation** (**查询参数**): string + + }}">fieldValidation + + +- **force** **查询参数**): boolean + + }}">force + + + +- **pretty** (**查询参数**): string + + }}">pretty + + +#### 响应 + + +200 (}}">DaemonSet): OK + +201 (}}">DaemonSet): 已创建 + +401: 未授权 + + +### `patch` 部分更新指定 DaemonSet 的状态 + +#### HTTP 请求 + +PATCH /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status + +#### 参数 + + +- **name** (**路径参数**): string, 必需 + + DaemonSet 的名称 + + +- **namespace** (**路径参数**): string, 必需 + + }}">namespace + + +- **body**: }}">Patch, 必需 + + + +- **dryRun** (**查询参数**): string + + }}">dryRun + + +- **fieldManager** (**查询参数**): string + + }}">fieldManager + + + +- **fieldValidation** (**查询参数**): string + + }}">fieldValidation + + +- **force** (**查询参数**): boolean + + }}">force + + + +- **pretty** (**查询参数**): string + + }}">pretty + + +#### 响应 + + +200 (}}">DaemonSet): OK + +201 (}}">DaemonSet): 已创建 + +401: 未授权 + + +### `delete` 删除一个 DaemonSet + +#### HTTP 请求 + +DELETE /apis/apps/v1/namespaces/{namespace}/daemonsets/{name} + +#### 参数 + + +- **name** (**路径参数**): string,必需 + + DaemonSet 的名称 + + +- **namespace** (**路径参数**): string,必需 + + }}">namespace + + +- **body**: }}">DeleteOptions + + + +- **dryRun** (**查询参数**): string + + }}">dryRun + + +- **gracePeriodSeconds** (**查询参数**): integer + + }}">gracePeriodSeconds + + + +- **pretty** (**查询参数**): string + + }}">pretty + + +- **propagationPolicy** (**查询参数**): string + + }}">propagationPolicy + + + +#### 响应 + + +200 (}}">Status): OK + +202 (}}">Status): 已接受 + +401: 未授权 + + +### `deletecollection` 删除 DaemonSet 的集合 + +#### HTTP 请求 + +DELETE /apis/apps/v1/namespaces/{namespace}/daemonsets + +#### 参数 + + + +- **namespace** (**路径参数**): string, 必需 + + }}">namespace + + +- **body**: }}">DeleteOptions + + + +- **continue** (**查询参数**): string + + }}">continue + + +- **dryRun** (**查询参数**): string + + }}">dryRun + + + +- **fieldSelector** (**查询参数**): string + + }}">fieldSelector + + +- **gracePeriodSeconds** (**查询参数**): integer + + }}">gracePeriodSeconds + + + +- **labelSelector** (**查询参数**): string + + }}">labelSelector + + +- **limit** (**查询参数**): integer + + }}">limit + + + +- **pretty** (**查询参数**): string + + }}">pretty + + +- **propagationPolicy** (**查询参数**): string + + }}">propagationPolicy + + + +- **resourceVersion** (**查询参数**): string + + }}">resourceVersion + + +- **resourceVersionMatch** (**查询参数**): string + + }}">resourceVersionMatch + + + +- **timeoutSeconds** (**查询参数**): integer + + }}">timeoutSeconds + + +#### 响应 + + +200 (}}">Status): OK + +401: 未授权 \ No newline at end of file