website/content/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1.md

48 KiB
Raw Blame History

api_metadata content_type description title weight
apiVersion import kind
apps/v1 k8s.io/api/apps/v1 DaemonSet
api_reference DaemonSet 表示守护进程集的配置。 DaemonSet 8

apiVersion: apps/v1

import "k8s.io/api/apps/v1"

DaemonSet

DaemonSet 表示守护进程集的配置。


  • apiVersion: apps/v1

  • kind: DaemonSet

DaemonSetSpec

DaemonSetSpec 是守护进程集的规约。


  • template (<a href="{{< ref "../workload-resources/pod-template-v1#PodTemplateSpec" >}}">PodTemplateSpec), 必需

    描述将要创建的 Pod 的对象。DaemonSet 将在与模板的节点选择器匹配的每个节点上 (如果未指定节点选择器,则在每个节点上)准确创建此 Pod 的副本。template.spec.restartPolicy 唯一被允许配置的值是 "Always"。更多信息: https://kubernetes.io/zh-cn/concepts/workloads/controllers/replicationcontroller#pod-template

  • minReadySeconds (int32)

    新建的 DaemonSet Pod 应该在没有任何容器崩溃的情况下处于就绪状态的最小秒数,这样它才会被认为是可用的。 默认为 0Pod 准备就绪后将被视为可用)。

  • 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而不考虑激增限制。 允许激增意味着如果就绪检查失败,任何给定节点上的守护进程集消耗的资源可能会翻倍, 因此资源密集型守护进程集应该考虑到它们可能会在中断期间导致驱逐。

        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 表示守护进程集的当前状态。


  • numberReady (int32),必需

    numberReady 是应该运行守护进程 Pod 并且有一个或多个 DaemonSet Pod 以就绪条件运行的节点数。

  • numberAvailable (int32)

    应该运行守护进程 Pod 并有一个或多个守护进程 Pod 正在运行和可用(就绪时长超过 spec.minReadySeconds的节点数量。

  • numberUnavailable (int32)

    应该运行守护进程 Pod 并且没有任何守护进程 Pod 正在运行且可用(至少已就绪 spec.minReadySeconds 秒)的节点数。

  • 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 是守护进程集的集合。


  • apiVersion: apps/v1

  • kind: DaemonSetList

Operations


get 读取指定的 DaemonSet

HTTP 请求

GET /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}

参数

  • name (路径参数): string, 必需

    DaemonSet 的名称

  • namespace (路径参数): string, 必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): OK

401: 未授权

get 读取指定的 DaemonSet 的状态

HTTP 请求

GET /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status

参数

  • name (路径参数): string, 必需

    DaemonSet 的名称

  • namespace (路径参数): string, 必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): OK

401: 未授权

list 列表或查看 DaemonSet 类型的对象

HTTP 请求

GET /apis/apps/v1/namespaces/{namespace}/daemonsets

参数

  • namespace (路径参数): string, 必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • allowWatchBookmarks (路径参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#allowWatchBookmarks" >}}">allowWatchBookmarks

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

  • watch (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#watch" >}}">watch

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSetList" >}}">DaemonSetList): OK

401: 未授权

list 列表或查看 DaemonSet 类型的对象

HTTP 请求

GET /apis/apps/v1/daemonsets

参数

  • allowWatchBookmarks (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#allowWatchBookmarks" >}}">allowWatchBookmarks

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

  • watch (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#watch" >}}">watch

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSetList" >}}">DaemonSetList): OK

401: 未授权

create 创建一个 DaemonSet

HTTP 请求

POST /apis/apps/v1/namespaces/{namespace}/daemonsets

参数

  • namespace (路径参数): string, 必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet, 必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): OK

201 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): 创建完成

202 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): 已接受

401: 未授权

update 替换指定的 DaemonSet

HTTP 请求

PUT /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}

参数

  • name (路径参数): string,必需

    DaemonSet 的名称

  • namespace (路径参数): string,必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet,必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): OK

201 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): 已创建

401: 未授权

update 替换指定 DaemonSet 的状态

HTTP 请求

PUT /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status

参数

  • name (路径参数): string, 必需

    DaemonSet 的名称

  • namespace (路径参数): string, 必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet, 必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): OK

201 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): 已创建

401: 未授权

patch 部分更新指定的 DaemonSet

HTTP 请求

PATCH /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}

参数

  • name (路径参数): string, 必需

    DaemonSet 的名称

  • namespace (路径参数): string, 必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../common-definitions/patch#Patch" >}}">Patch, 必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • force 查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#force" >}}">force

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): OK

201 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): 已创建

401: 未授权

patch 部分更新指定 DaemonSet 的状态

HTTP 请求

PATCH /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}/status

参数

  • name (路径参数): string, 必需

    DaemonSet 的名称

  • namespace (路径参数): string, 必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../common-definitions/patch#Patch" >}}">Patch, 必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • force (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#force" >}}">force

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): OK

201 (<a href="{{< ref "../workload-resources/daemon-set-v1#DaemonSet" >}}">DaemonSet): 已创建

401: 未授权

delete 删除一个 DaemonSet

HTTP 请求

DELETE /apis/apps/v1/namespaces/{namespace}/daemonsets/{name}

参数

  • name (路径参数): string,必需

    DaemonSet 的名称

  • namespace (路径参数): string,必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • gracePeriodSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • propagationPolicy (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy

响应

200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK

202 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): 已接受

401: 未授权

deletecollection 删除 DaemonSet 的集合

HTTP 请求

DELETE /apis/apps/v1/namespaces/{namespace}/daemonsets

参数

  • namespace (路径参数): string, 必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • gracePeriodSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • propagationPolicy (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

响应

200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK

401: 未授权