Search code examples
azureazure-aksazure-machine-learning-service

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


I am currently deploying a model trained using AzureML to an AKS cluster as follows:

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)

I would like this service to be scheduled on a specific nodepool. With normal Kubernetes deployment, I can specify a nodeSelector like:

spec:
  nodeSelector:
    myNodeName: alpha

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?


Solution

  • 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?

    As per Configure Kubernetes clusters for machine learning:

    nodeSelector : Set the node selector so the extension components and the training/inference workloads will only be deployed to the nodes with all specified selectors.

    For example:

    nodeSelector.key=value , nodeSelector.node-purpose=worker and nodeSelector.node-region=eastus

    You can refer to Assigning Pods to Nodes and Cannot create nodepool with node-restriction.kubernetes.io/ prefix label