在将 Azure ML 模型部署到 AKS 群集时如何指定 nodeSelector?

How do I specify nodeSelector while deploying an Azure ML model to an AKS Cluster?

我目前正在将使用 AzureML 训练的模型部署到 AKS 集群,如下所示:

deployment_config_aks = AksWebservice.deploy_configuration(
    cpu_cores = 1, 
    memory_gb = 1)

service = Model.deploy(ws, "test", [model], inference_config, deployment_config_aks, aks_target)

我希望将此服务安排在特定的节点池上。对于正常的 Kubernetes 部署,我可以指定一个 nodeSelector,例如:

spec:
  nodeSelector:
    myNodeName: alpha

如何在将 Azure ML 模型部署到 AKS 群集时指定 nodeSelector?或者一般来说,有没有办法将我的自定义 pod 规范与 Azure ML 库生成的规范合并?

How do I specify a nodeSelector while deploying an Azure ML model to an AKS Cluster? Or in general, is there a way to merge my custom pod spec with the one generated by Azure ML library?

根据Configure Kubernetes clusters for machine learning

nodeSelector:设置节点选择器,以便扩展组件和 training/inference 工作负载将仅部署到具有所有指定选择器的节点。

例如:

nodeSelector.key=value , nodeSelector.node-purpose=workernodeSelector.node-region=eastus

可以参考Assigning Pods to Nodes and Cannot create nodepool with node-restriction.kubernetes.io/ prefix label