节点

节点是 Kubernetes 中的 worker 节点。

apiVersion: v1

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

节点

节点是 Kubernetes 中的 worker 节点。每个节点在缓存(即在 etcd 中)中都有一个唯一的标识符。


NodeSpec

NodeSpec 描述创建节点时使用的属性。


  • configSource (NodeConfigSource)

    已弃用:以前用于指定节点的 DynamicKubeletConfig 功能的配置源。此功能已被移除。

    NodeConfigSource 指定节点配置的来源。除元数据外,正好有一个子字段必须是非空的。此 API 自 1.22 版本起已弃用

    • configSource.configMap (ConfigMapNodeConfigSource)

      ConfigMap 是对节点的 ConfigMap 的引用

      ConfigMapNodeConfigSource 包含信息,用于引用 ConfigMap 作为节点的配置源。此 API 自 1.22 版本起已弃用:https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configuration

      • configSource.configMap.kubeletConfigKey (string), required

        KubeletConfigKey 声明引用的 ConfigMap 中的哪个键对应于 KubeletConfiguration 结构。此字段在所有情况下都必填。

      • configSource.configMap.name (string), required

        Name 是引用的 ConfigMap 的 metadata.name。此字段在所有情况下都必填。

      • configSource.configMap.namespace (string), required

        Namespace 是引用的 ConfigMap 的 metadata.namespace。此字段在所有情况下都必填。

      • configSource.configMap.resourceVersion (string)

        ResourceVersion 是引用的 ConfigMap 的 metadata.ResourceVersion。此字段在 Node.Spec 中被禁止,在 Node.Status 中必填。

      • configSource.configMap.uid (string)

        UID 是引用的 ConfigMap 的 metadata.UID。此字段在 Node.Spec 中被禁止,在 Node.Status 中必填。

  • externalID (string)

    已弃用。并非所有 kubelet 都会设置此字段。在 1.13 之后删除字段。参见:https://issues.k8s.io/61966

  • podCIDR (string)

    PodCIDR 表示分配给节点的 pod IP 范围。

  • podCIDRs ([]string)

    podCIDRs 表示分配给节点的 IP 范围,供该节点上的 Pod 使用。如果指定了此字段,则第 0 个条目必须与 podCIDR 字段匹配。它最多可以包含每个 IPv4 和 IPv6 的 1 个值。

  • providerID (string)

    云提供商分配给节点的 ID,格式为:<ProviderName>://<ProviderSpecificNodeID>

  • taints ([]Taint)

    如果指定,则为节点的污点。

    此污点附加到的节点对任何不耐受此污点的 pod 都有“影响”。

    • taints.effect (string), required

      必填。污点对不耐受污点的 pod 的影响。有效的 effect 为 NoSchedule、PreferNoSchedule 和 NoExecute。

    • taints.key (string), required

      必填。要应用于节点的污点键。

    • taints.timeAdded (Time)

      TimeAdded 表示添加污点的时间。它只对 NoExecute 污点写入。

      Time 是 time.Time 的包装器,它支持正确地编组到 YAML 和 JSON。包装器被提供给时间包提供的许多工厂方法。

    • taints.value (string)

      对应于污点键的污点值。

  • unschedulable (boolean)

    Unschedulable 控制节点对新 pod 的可调度性。默认情况下,节点是可调度的。更多信息:https://kubernetes.ac.cn/docs/concepts/nodes/node/#manual-node-administration

NodeStatus

NodeStatus 是有关节点当前状态的信息。


  • addresses ([]NodeAddress)

    补丁策略:根据键 type 合并

    可到达节点的地址列表。如果可用,则从云提供商查询。更多信息:https://kubernetes.ac.cn/docs/concepts/nodes/node/#addresses 注意:此字段声明为可合并,但合并键不够唯一,这会导致合并时数据损坏。调用者应改为使用完整的替换补丁。参见 https://pr.k8s.io/79391 以获取示例。消费者应假设地址在节点的生命周期内可能会发生变化。但是,有些例外情况可能无法实现这一点,例如继承节点自身状态中的地址的 Pod 或向下 API(status.hostIP)的消费者。

    NodeAddress 包含节点地址的信息。

    • addresses.address (string), required

      节点地址。

    • addresses.type (string), required

      节点地址类型,其中之一为 Hostname、ExternalIP 或 InternalIP。

  • allocatable (map[string]Quantity)

    Allocatable 表示节点上可用于调度的资源。默认为 Capacity。

  • capacity (map[string]Quantity)

    Capacity 表示节点的总资源。更多信息:https://kubernetes.ac.cn/docs/concepts/storage/persistent-volumes#capacity

  • conditions ([]NodeCondition)

    补丁策略:根据键 type 合并

    Conditions 是当前观察到的节点条件的数组。更多信息:https://kubernetes.ac.cn/docs/concepts/nodes/node/#condition

    NodeCondition 包含有关节点的条件信息。

    • conditions.status (string), required

      条件的状态,其中之一为 True、False、Unknown。

    • conditions.type (string), required

      节点条件的类型。

    • conditions.lastHeartbeatTime (Time)

      上次收到有关给定条件的更新的时间。

      Time 是 time.Time 的包装器,它支持正确地编组到 YAML 和 JSON。包装器被提供给时间包提供的许多工厂方法。

    • conditions.lastTransitionTime (Time)

      条件从一种状态过渡到另一种状态的最后时间。

      Time 是 time.Time 的包装器,它支持正确地编组到 YAML 和 JSON。包装器被提供给时间包提供的许多工厂方法。

    • conditions.message (string)

      指示上次过渡详细信息的人类可读消息。

    • conditions.reason (string)

      (简短的)条件上次过渡的原因。

  • config (NodeConfigStatus)

    通过动态 Kubelet 配置功能分配给节点的配置的状态。

    NodeConfigStatus 描述分配给 Node.Spec.ConfigSource 的配置的状态。

    • config.active (NodeConfigSource)

      Active 报告节点正在积极使用的已检查点配置。Active 将表示已分配配置的当前版本,或当前 LastKnownGood 配置,具体取决于尝试使用已分配配置是否会导致错误。

      NodeConfigSource 指定节点配置的来源。除元数据外,正好有一个子字段必须是非空的。此 API 自 1.22 版本起已弃用

      • config.active.configMap (ConfigMapNodeConfigSource)

        ConfigMap 是对节点的 ConfigMap 的引用

        ConfigMapNodeConfigSource 包含信息,用于引用 ConfigMap 作为节点的配置源。此 API 自 1.22 版本起已弃用:https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configuration

        • config.active.configMap.kubeletConfigKey (string), required

          KubeletConfigKey 声明引用的 ConfigMap 中的哪个键对应于 KubeletConfiguration 结构。此字段在所有情况下都必填。

        • config.active.configMap.name (string), required

          Name 是引用的 ConfigMap 的 metadata.name。此字段在所有情况下都必填。

        • config.active.configMap.namespace (string), required

          Namespace 是引用的 ConfigMap 的 metadata.namespace。此字段在所有情况下都必填。

        • config.active.configMap.resourceVersion (string)

          ResourceVersion 是引用的 ConfigMap 的 metadata.ResourceVersion。此字段在 Node.Spec 中被禁止,在 Node.Status 中必填。

        • config.active.configMap.uid (string)

          UID 是引用的 ConfigMap 的 metadata.UID。此字段在 Node.Spec 中被禁止,在 Node.Status 中必填。

    • config.assigned (NodeConfigSource)

      Assigned 报告节点将尝试使用的已检查点配置。当 Node.Spec.ConfigSource 更新时,节点会将关联的配置有效负载检查点到本地磁盘,以及一个记录,指示预期的配置。节点参考此记录来选择其配置检查点,并在 Assigned 中报告此记录。仅当记录已检查点到磁盘后,Assigned 才会在状态中更新。当 Kubelet 重新启动时,它会尝试通过加载和验证由 Assigned 标识的已检查点有效负载来使 Assigned 配置成为 Active 配置。

      NodeConfigSource 指定节点配置的来源。除元数据外,正好有一个子字段必须是非空的。此 API 自 1.22 版本起已弃用

      • config.assigned.configMap (ConfigMapNodeConfigSource)

        ConfigMap 是对节点的 ConfigMap 的引用

        ConfigMapNodeConfigSource 包含信息,用于引用 ConfigMap 作为节点的配置源。此 API 自 1.22 版本起已弃用:https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configuration

        • config.assigned.configMap.kubeletConfigKey (string), required

          KubeletConfigKey 声明引用的 ConfigMap 中的哪个键对应于 KubeletConfiguration 结构。此字段在所有情况下都必填。

        • config.assigned.configMap.name (string), required

          Name 是引用的 ConfigMap 的 metadata.name。此字段在所有情况下都必填。

        • config.assigned.configMap.namespace (string), required

          Namespace 是引用的 ConfigMap 的 metadata.namespace。此字段在所有情况下都必填。

        • config.assigned.configMap.resourceVersion (string)

          ResourceVersion 是引用的 ConfigMap 的 metadata.ResourceVersion。此字段在 Node.Spec 中被禁止,在 Node.Status 中必填。

        • config.assigned.configMap.uid (string)

          UID 是引用的 ConfigMap 的 metadata.UID。此字段在 Node.Spec 中被禁止,在 Node.Status 中必填。

    • config.error (string)

      Error 描述将 Spec.ConfigSource 与 Active 配置进行协调时遇到的任何问题。例如,尝试将 Spec.ConfigSource 检查点到本地 Assigned 记录,尝试检查点与 Spec.ConfigSource 关联的有效负载,尝试加载或验证 Assigned 配置等,可能会发生错误。错误可能在同步配置的不同点发生。较早的错误(例如,下载或检查点错误)不会导致回滚到 LastKnownGood,并且可能会在 Kubelet 重试过程中解决。较晚的错误(例如,加载或验证已检查点的配置)会导致回滚到 LastKnownGood。在后一种情况下,通常可以通过修复在 Spec.ConfigSource 中分配的配置来解决错误。您可以在 Kubelet 日志中搜索错误消息以查找其他调试信息。Error 是错误状态的人类可读描述;机器可以检查 Error 是否为空,但不要依赖于 Error 文本在 Kubelet 版本之间的稳定性。

    • config.lastKnownGood (NodeConfigSource)

      LastKnownGood 报告了节点在尝试使用 Assigned 配置时遇到错误时将回退到的检查点配置。当节点确定 Assigned 配置稳定且正确时,Assigned 配置将变为 LastKnownGood 配置。目前,这被实现为从更新 Assigned 配置的本地记录开始的 10 分钟浸泡期。如果 Assigned 配置在此期间结束时处于 Active 状态,它将变为 LastKnownGood。请注意,如果 Spec.ConfigSource 重置为 nil(使用本地默认值),LastKnownGood 也将立即重置为 nil,因为始终假定本地默认配置是良好的。你不应该对节点确定配置稳定性和正确性的方法做出任何假设,因为这可能会在将来发生变化或变得可配置。

      NodeConfigSource 指定节点配置的来源。除元数据外,正好有一个子字段必须是非空的。此 API 自 1.22 版本起已弃用

      • config.lastKnownGood.configMap (ConfigMapNodeConfigSource)

        ConfigMap 是对节点的 ConfigMap 的引用

        ConfigMapNodeConfigSource 包含信息,用于引用 ConfigMap 作为节点的配置源。此 API 自 1.22 版本起已弃用:https://git.k8s.io/enhancements/keps/sig-node/281-dynamic-kubelet-configuration

        • config.lastKnownGood.configMap.kubeletConfigKey (string), 必需

          KubeletConfigKey 声明引用的 ConfigMap 中的哪个键对应于 KubeletConfiguration 结构。此字段在所有情况下都必填。

        • config.lastKnownGood.configMap.name (string), 必需

          Name 是引用的 ConfigMap 的 metadata.name。此字段在所有情况下都必填。

        • config.lastKnownGood.configMap.namespace (string), 必需

          Namespace 是引用的 ConfigMap 的 metadata.namespace。此字段在所有情况下都必填。

        • config.lastKnownGood.configMap.resourceVersion (string)

          ResourceVersion 是引用的 ConfigMap 的 metadata.ResourceVersion。此字段在 Node.Spec 中被禁止,在 Node.Status 中必填。

        • config.lastKnownGood.configMap.uid (string)

          UID 是引用的 ConfigMap 的 metadata.UID。此字段在 Node.Spec 中被禁止,在 Node.Status 中必填。

  • daemonEndpoints (NodeDaemonEndpoints)

    在节点上运行的守护程序的端点。

    NodeDaemonEndpoints 列出了在节点上运行的守护程序打开的端口。

    • daemonEndpoints.kubeletEndpoint (DaemonEndpoint)

      Kubelet 监听的端点。

      DaemonEndpoint 包含有关单个守护程序端点的信息。

      • daemonEndpoints.kubeletEndpoint.Port (int32), 必需

        给定端点的端口号。

  • images ([]ContainerImage)

    此节点上的容器映像列表

    描述容器映像

    • images.names ([]string)

      此映像已知的名称。例如 ["kubernetes.example/hyperkube:v1.0.7", "cloud-vendor.registry.example/cloud-vendor/hyperkube:v1.0.7"]

    • images.sizeBytes (int64)

      映像的大小(以字节为单位)。

  • nodeInfo (NodeSystemInfo)

    一组 ID/UUID 用于唯一标识节点。更多信息:https://kubernetes.ac.cn/docs/concepts/nodes/node/#info

    NodeSystemInfo 是一组 ID/UUID 用于唯一标识节点。

    • nodeInfo.architecture (string), 必需

      节点报告的体系结构

    • nodeInfo.bootID (string), 必需

      节点报告的启动 ID。

    • nodeInfo.containerRuntimeVersion (string), 必需

      节点通过运行时远程 API 报告的 ContainerRuntime 版本(例如 containerd://1.4.2)。

    • nodeInfo.kernelVersion (string), 必需

      节点从 'uname -r' 报告的内核版本(例如 3.16.0-0.bpo.4-amd64)。

    • nodeInfo.kubeProxyVersion (string), 必需

      节点报告的 KubeProxy 版本。

    • nodeInfo.kubeletVersion (string), 必需

      节点报告的 Kubelet 版本。

    • nodeInfo.machineID (string), 必需

      节点报告的 MachineID。为了在集群中进行唯一的机器识别,首选此字段。从 man(5) machine-id 了解更多信息:http://man7.org/linux/man-pages/man5/machine-id.5.html

    • nodeInfo.operatingSystem (string), 必需

      节点报告的操作系统

    • nodeInfo.osImage (string), 必需

      节点从 /etc/os-release 报告的 OS 映像(例如 Debian GNU/Linux 7 (wheezy))。

    • nodeInfo.systemUUID (string), 必需

      节点报告的 SystemUUID。为了进行唯一的机器识别,首选 MachineID。此字段特定于 Red Hat 主机 https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/rhsm/uuid

  • phase (string)

    NodePhase 是节点最近观察到的生命周期阶段。更多信息:https://kubernetes.ac.cn/docs/concepts/nodes/node/#phase 此字段从不填充,现在已弃用。

  • volumesAttached ([]AttachedVolume)

    附加到节点的卷列表。

    AttachedVolume 描述附加到节点的卷

    • volumesAttached.devicePath (string), 必需

      DevicePath 表示卷应可用的设备路径

    • volumesAttached.name (string), 必需

      附加卷的名称

  • volumesInUse ([]string)

    节点正在使用的(已挂载)可附加卷列表。

NodeList

NodeList 是已向主节点注册的所有节点的完整列表。


操作


get 读取指定的节点

HTTP 请求

GET /api/v1/nodes/{name}

参数

  • name (在路径中): string, 必需

    节点的名称

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

401: 未经授权

get 读取指定节点的状态

HTTP 请求

GET /api/v1/nodes/{name}/status

参数

  • name (在路径中): string, 必需

    节点的名称

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

401: 未经授权

list 列出或观察 Node 类型的对象

HTTP 请求

GET /api/v1/nodes

参数

响应

200 (NodeList): OK

401: 未经授权

create 创建节点

HTTP 请求

POST /api/v1/nodes

参数

响应

200 (Node): OK

201 (Node): 已创建

202 (Node): 已接受

401: 未经授权

update 替换指定的节点

HTTP 请求

PUT /api/v1/nodes/{name}

参数

  • name (在路径中): string, 必需

    节点的名称

  • body: Node, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

201 (Node): 已创建

401: 未经授权

update 替换指定节点的状态

HTTP 请求

PUT /api/v1/nodes/{name}/status

参数

  • name (在路径中): string, 必需

    节点的名称

  • body: Node, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

201 (Node): 已创建

401: 未经授权

patch 部分更新指定的节点

HTTP 请求

PATCH /api/v1/nodes/{name}

参数

  • name (在路径中): string, 必需

    节点的名称

  • body: Patch, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (在查询中): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

201 (Node): 已创建

401: 未经授权

patch 部分更新指定节点的状态

HTTP 请求

PATCH /api/v1/nodes/{name}/status

参数

  • name (在路径中): string, 必需

    节点的名称

  • body: Patch, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (在查询中): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

201 (Node): 已创建

401: 未经授权

delete 删除节点

HTTP 请求

DELETE /api/v1/nodes/{name}

参数

响应

200 (Status): OK

202 (Status): 已接受

401: 未经授权

deletecollection 删除 Node 集合

HTTP 请求

DELETE /api/v1/nodes

参数

响应

200 (Status): OK

401: 未经授权

此页面是自动生成的。

如果你打算报告有关此页面的问题,请在你的问题描述中提到该页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。

最后修改时间:2023 年 4 月 3 日下午 8:22 PST:API Ref 多页面 v1.27 (7b39e9a9ec)