Example: Serving models on dedicated GPU nodes

This example illustrates how to use taints, tolerations with nodeAffinity or nodeSelector to assign GPU nodes to specific models.

Note: Configuration options depend on your cluster setup and the desired outcome. The Seldon CRDs for Seldon Core 2 Pods offer complete customization of Pod specifications, allowing you to apply additional Kubernetes customizations as needed.

To serve a model on a dedicated GPU node, you should follow these steps:

Configuring the GPU node

Note: To dedicate a set of nodes to run only a specific group of inference servers, you must first provision an additional set of nodes within the Kubernetes cluster for the remaining Seldon Core 2 components. For more information about adding labels and taint to the GPU nodes in your Kubernetes cluster refer to the respective cloud provider documentation.

You can add the taint when you are creating the node or after the node has been provisioned. You can apply the same taint to multiple nodes, not just a single node. A common approach is to define the taint at the node pool level.

When you apply a NoSchedule taint to a node after it is created it may result in existing Pods that do not have a matching toleration to remain on the node without being evicted. To ensure that such Pods are removed, you can use the NoExecute taint effect instead.

In this example, the node includes several labels that are used later for node affinity settings. You may choose to specify some labels, while others are usually added by the cloud provider or a GPU operator installed in the cluster. \


apiVersion: v1
kind: Node
metadata:
  name: example-node         # Replace with the actual node name
  labels:
    pool: infer-srv          # Custom label
    nvidia.com/gpu.product: A100-SXM4-40GB-MIG-1g.5gb-SHARED  # Sample label from GPU discovery
    cloud.google.com/gke-accelerator: nvidia-a100-80gb      # GKE without NVIDIA GPU operator
    cloud.google.com/gke-accelerator-count: "2"              # Accelerator count
spec:
  taints:
    - effect: NoSchedule
      key: seldon-gpu-srv
      value: "true"

Configure inference servers

To ensure a specific inference server Pod runs only on the nodes you've configured, you can use nodeSelector or nodeAffinity together with a toleration by modifying one of the following:

  • Seldon Server custom resource: Apply changes to each individual inference server.

  • ServerConfig custom resource: Apply settings across multiple inference servers at once.

Configuring Seldon Server custom resource While nodeSelector requires an exact match of node labels for server Pods to select a node, nodeAffinity offers more fine-grained control. It enables a conditional approach by using logical operators in the node selection process. For more information, see Affinity and anti-affinity.

In this example, a nodeSelector and a toleration is set for the Seldon Server custom resource.

Configuring ServerConfig custom resource

This configuration automatically affects all servers using that ServerConfig, unless you specify server-specific overrides, which takes precedence.

Configuring models

When you have a set of inference servers running exclusively on GPU nodes, you can assign a model to one of those servers in two ways:

  • Custom model requirements (recommended)

  • Explicit server pinning

Here's the distinction between the two methods of assigning models to servers.

Method
Behavior

Custom model requirements

If the assigned server cannot load the model due to insufficient resources, another similarly-capable server can be selected to load the model.

Explicit pinning

If the specified server lacks sufficient memory or resources, the model load fails without trying another server.

When you specify a requirement matching a server capability in the model custom resource it loads the model on any inference server with a capability matching the requirements.

Ensure that the additional capability that matches the requirement label is added to the Server custom resource.

Instead of adding a capability using extraCapabilities on a Server custom resource, you may also add to the list of capabilities in the associated ServerConfig custom resource. This applies to all servers referencing the configuration.

Last updated

Was this helpful?