创建一个 NodePool - 亚马逊 SageMaker AI

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

创建一个 NodePool

NodePool 对 Karpenter 可创建的节点,以及可在这些节点上运行的容器组(pod)设置了限制。可将 NodePool 配置为执行以下操作:

  • 将节点创建限制为特定的区域、实例类型和计算机架构。

  • 定义标签或污点以限制可在 Karpenter 所创建的节点上运行的容器组(pod)。

注意

HyperPod 提供者支持一组有限的众所周知的 Kubernetes 和 Karpenter 要求,如下所述。

以下步骤展示了如何创建 NodePool

  1. 创建一个名为 nodepool.yaml 的 YAML 文件,该文件包含所需的 NodePool 配置。

  2. 您可以使用以下示例配置。

    Conditions 下方查找 Ready 以确认所有依赖资源均运行正常。

    apiVersion: karpenter.sh/v1 kind: NodePool metadata: name: sample-np spec: template: spec: nodeClassRef: group: karpenter.sagemaker.amazonaws.com kind: HyperpodNodeClass name: multiazc5 expireAfter: Never requirements: - key: node.kubernetes.io/instance-type operator: Exists
  3. NodePool 应用于集群:

    kubectl apply -f nodepool.yaml
  4. 监控 NodePool 状态,确保状态中的 Ready 条件设置为 True

    kubectl get nodepool sample-np -oyaml
    apiVersion: karpenter.sh/v1 kind: NodePool metadata: name: <nodepool-name> uid: <resource-uid> ... spec: disruption: budgets: - nodes: 90% consolidateAfter: 0s consolidationPolicy: WhenEmptyOrUnderutilized template: spec: expireAfter: 720h nodeClassRef: group: karpenter.sagemaker.amazonaws.com kind: HyperpodNodeClass name: <nodeclass-name> requirements: - key: node.kubernetes.io/instance-type operator: Exists status: conditions: - lastTransitionTime: "<timestamp>" message: "" observedGeneration: 2 reason: ValidationSucceeded status: "True" type: ValidationSucceeded - lastTransitionTime: "<timestamp>" message: "" observedGeneration: 2 reason: NodeClassReady status: "True" type: NodeClassReady - lastTransitionTime: "<timestamp>" message: "" observedGeneration: 2 reason: Ready status: "True" type: Ready

Karpenter 提供商 HyperPod支持的标签

这些是您可以在 NodePool 配置中指定的可选约束和要求。

要求类型

用途

使用 Case/Supported 值

建议

实例类型(node.kubernetes.io/instance-type

控制 Karpenter 可以从哪些 SageMaker 实例类型中进行选择

不要仅限定于 ml.c5.xlarge,而是让 Karpenter 从实例组中的所有可用类型中进行选择

将此项保留为未定义状态,或使用 Exists 操作符,以便 Karpenter 在选择高性价比实例类型时拥有最大灵活性。

可用区(topology.kubernetes.io/zone

控制可以在哪些AWS可用区中创建节点

特定的区域名称,例如 us-east-1c。当您出于延迟或合规性原因,需要容器组(pod)在特定区域内运行时使用。

不适用

架构(kubernetes.io/arch

指定 CPU 架构

仅 amd64(目前不支持 ARM)

不适用