Node

节点是 Kubernetes 中的工作节点。

apiVersion: v1

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

Node

节点是 Kubernetes 中的工作节点。每个节点在缓存中(即在 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 表示分配给节点以供该节点上的 Pod 使用的 IP 范围。如果指定此字段,则第 0 个条目必须与 podCIDR 字段匹配。对于 IPv4 和 IPv6,它最多可以包含一个值。

  • providerID (string)

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

  • taints ([]Taint)

    原子:将在合并期间被替换

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

    将此 Taint 附加到的节点对不容忍该 Taint 的任何 Pod 具有“effect”效果。

    • taints.effect (string), required

      必需。对不容忍污点的 Pod 的污点效果。有效效果是 NoSchedule、PreferNoSchedule 和 NoExecute。

      可能的枚举值

      • "NoExecute" 驱逐任何未容忍污点的已运行 Pod。目前由 NodeController 强制执行。
      • "NoSchedule" 不允许新的 Pod 调度到节点,除非它们容忍污点,但允许提交到 Kubelet 而不通过调度器的所有 Pod 启动,并允许所有已运行的 Pod 继续运行。由调度器强制执行。
      • "PreferNoSchedule" 类似于 TaintEffectNoSchedule,但调度器尝试不将新的 Pod 调度到节点,而不是完全禁止新的 Pod 调度到节点。由调度器强制执行。
    • taints.key (string), required

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

    • taints.timeAdded (Time)

      TimeAdded 表示添加污点的时间。

      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)

    Patch 策略:在键 type 上合并

    映射:在合并期间将保留键类型上的唯一值

    可到达节点的地址列表。如果可用,则从云提供商查询。更多信息:https://kubernetes.ac.cn/docs/reference/node/node-status/#addresses 注意:此字段声明为可合并的,但合并键不够唯一,这可能导致合并时数据损坏。调用者应使用完全替换补丁。请参阅 https://pr.k8s.io/79391 以获取示例。使用者应假定地址可以在 Node 的生命周期内发生变化。但是,在某些情况下,这可能是不可能的,例如继承 Node 地址的 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/reference/node/node-status/#capacity

  • conditions ([]NodeCondition)

    Patch 策略:在键 type 上合并

    映射:在合并期间将保留键类型上的唯一值

    Conditions 是当前观察到的节点条件数组。更多信息:https://kubernetes.ac.cn/docs/reference/node/node-status/#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 reports the checkpointed config the node will try to use. When Node.Spec.ConfigSource is updated, the node checkpoints the associated config payload to local disk, along with a record indicating intended config. The node refers to this record to choose its config checkpoint, and reports this record in Assigned. Assigned only updates in the status after the record has been checkpointed to disk. When the Kubelet is restarted, it tries to make the Assigned config the Active config by loading and validating the checkpointed payload identified by Assigned.

      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 describes any problems reconciling the Spec.ConfigSource to the Active config. Errors may occur, for example, attempting to checkpoint Spec.ConfigSource to the local Assigned record, attempting to checkpoint the payload associated with Spec.ConfigSource, attempting to load or validate the Assigned config, etc. Errors may occur at different points while syncing config. Earlier errors (e.g. download or checkpointing errors) will not result in a rollback to LastKnownGood, and may resolve across Kubelet retries. Later errors (e.g. loading or validating a checkpointed config) will result in a rollback to LastKnownGood. In the latter case, it is usually possible to resolve the error by fixing the config assigned in Spec.ConfigSource. You can find additional information for debugging by searching the error message in the Kubelet log. Error is a human-readable description of the error state; machines can check whether or not Error is empty, but should not rely on the stability of the Error text across Kubelet versions.

    • config.lastKnownGood (NodeConfigSource)

      LastKnownGood reports the checkpointed config the node will fall back to when it encounters an error attempting to use the Assigned config. The Assigned config becomes the LastKnownGood config when the node determines that the Assigned config is stable and correct. This is currently implemented as a 10-minute soak period starting when the local record of Assigned config is updated. If the Assigned config is Active at the end of this period, it becomes the LastKnownGood. Note that if Spec.ConfigSource is reset to nil (use local defaults), the LastKnownGood is also immediately reset to nil, because the local default config is always assumed good. You should not make assumptions about the node's method of determining config stability and correctness, as this may change or become configurable in the future.

      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), required

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

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

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

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

          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)

    Endpoints of daemons running on the Node.

    NodeDaemonEndpoints lists ports opened by daemons running on the Node.

    • daemonEndpoints.kubeletEndpoint (DaemonEndpoint)

      Endpoint on which Kubelet is listening.

      DaemonEndpoint contains information about a single Daemon endpoint.

      • daemonEndpoints.kubeletEndpoint.Port (int32), required

        Port number of the given endpoint.

  • declaredFeatures ([]string)

    原子:将在合并期间被替换

    DeclaredFeatures represents the features related to feature gates that are declared by the node.

  • features (NodeFeatures)

    Features describes the set of features implemented by the CRI implementation.

    NodeFeatures describes the set of features implemented by the CRI implementation. The features contained in the NodeFeatures should depend only on the cri implementation independent of runtime handlers.

    • features.supplementalGroupsPolicy (boolean)

      SupplementalGroupsPolicy is set to true if the runtime supports SupplementalGroupsPolicy and ContainerUser.

  • images ([]ContainerImage)

    原子:将在合并期间被替换

    List of container images on this node

    Describe a container image

    • images.names ([]string)

      原子:将在合并期间被替换

      Names by which this image is known. e.g. ["kubernetes.example/hyperkube:v1.0.7", "cloud-vendor.registry.example/cloud-vendor/hyperkube:v1.0.7"]

    • images.sizeBytes (int64)

      The size of the image in bytes.

  • nodeInfo (NodeSystemInfo)

    Set of ids/uuids to uniquely identify the node. More info: https://kubernetes.ac.cn/docs/reference/node/node-status/#info

    NodeSystemInfo is a set of ids/uuids to uniquely identify the node.

    • nodeInfo.architecture (string), required

      The Architecture reported by the node

    • nodeInfo.bootID (string), required

      Boot ID reported by the node.

    • nodeInfo.containerRuntimeVersion (string), required

      ContainerRuntime Version reported by the node through runtime remote API (e.g. containerd://1.4.2).

    • nodeInfo.kernelVersion (string), required

      Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).

    • nodeInfo.kubeProxyVersion (string), required

      Deprecated: KubeProxy Version reported by the node.

    • nodeInfo.kubeletVersion (string), required

      Kubelet Version reported by the node.

    • nodeInfo.machineID (string), required

      MachineID reported by the node. For unique machine identification in the cluster this field is preferred. Learn more from man(5) machine-id: http://man7.org/linux/man-pages/man5/machine-id.5.html

    • nodeInfo.operatingSystem (string), required

      The Operating System reported by the node

    • nodeInfo.osImage (string), required

      OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)).

    • nodeInfo.systemUUID (string), required

      SystemUUID reported by the node. For unique machine identification MachineID is preferred. This field is specific to Red Hat hosts https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html/rhsm/uuid

    • nodeInfo.swap (NodeSwapStatus)

      Swap Info reported by the node.

      NodeSwapStatus represents swap memory information.

      • nodeInfo.swap.capacity (int64)

        Total amount of swap memory in bytes.

  • phase (string)

    NodePhase is the recently observed lifecycle phase of the node. More info: https://kubernetes.ac.cn/docs/concepts/nodes/node/#phase The field is never populated, and now is deprecated.

    可能的枚举值

    • "Pending" means the node has been created/added by the system, but not configured.
    • "Running" means the node has been configured and has Kubernetes components running.
    • "Terminated" means the node has been removed from the cluster.
  • runtimeHandlers ([]NodeRuntimeHandler)

    原子:将在合并期间被替换

    The available runtime handlers.

    NodeRuntimeHandler is a set of runtime handler information.

    • runtimeHandlers.features (NodeRuntimeHandlerFeatures)

      Supported features.

      NodeRuntimeHandlerFeatures is a set of features implemented by the runtime handler.

      • runtimeHandlers.features.recursiveReadOnlyMounts (boolean)

        RecursiveReadOnlyMounts is set to true if the runtime handler supports RecursiveReadOnlyMounts.

      • runtimeHandlers.features.userNamespaces (boolean)

        UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes.

    • runtimeHandlers.name (string)

      Runtime handler name. Empty for the default runtime handler.

  • volumesAttached ([]AttachedVolume)

    原子:将在合并期间被替换

    List of volumes that are attached to the node.

    AttachedVolume describes a volume attached to a node

    • volumesAttached.devicePath (string), required

      DevicePath represents the device path where the volume should be available

    • volumesAttached.name (string), required

      Name of the attached volume

  • volumesInUse ([]string)

    原子:将在合并期间被替换

    List of attachable volumes in use (mounted) by the node.

NodeList

NodeList is the whole list of all Nodes which have been registered with master.


操作


get read the specified Node

HTTP 请求

GET /api/v1/nodes/{name}

Parameters

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

    name of the Node

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

401: 未授权

get read status of the specified Node

HTTP 请求

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

Parameters

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

    name of the Node

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

401: 未授权

list list or watch objects of kind Node

HTTP 请求

GET /api/v1/nodes

Parameters

响应

200 (NodeList): OK

401: 未授权

create create a Node

HTTP 请求

POST /api/v1/nodes

Parameters

响应

200 (Node): OK

201 (Node): Created

202 (Node): Accepted

401: 未授权

update replace the specified Node

HTTP 请求

PUT /api/v1/nodes/{name}

Parameters

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

    name of the Node

  • body: Node, required

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

201 (Node): Created

401: 未授权

update replace status of the specified Node

HTTP 请求

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

Parameters

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

    name of the Node

  • body: Node, required

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

201 (Node): Created

401: 未授权

patch partially update the specified Node

HTTP 请求

PATCH /api/v1/nodes/{name}

Parameters

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

    name of the Node

  • body: Patch, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (in query): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

201 (Node): Created

401: 未授权

patch partially update status of the specified Node

HTTP 请求

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

Parameters

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

    name of the Node

  • body: Patch, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (in query): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (Node): OK

201 (Node): Created

401: 未授权

delete delete a Node

HTTP 请求

DELETE /api/v1/nodes/{name}

Parameters

响应

200 (Status): 确定

202 (Status): 已接受

401: 未授权

deletecollection delete collection of Node

HTTP 请求

DELETE /api/v1/nodes

Parameters

响应

200 (Status): 确定

401: 未授权

本页面是自动生成的。

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

Last modified December 21, 2025 at 5:37 PM PST: Update resource docs for v1.35 (85b57273c5)