Jethro
Jethro

Reputation: 3329

EKS GPU worker group using Terraform

Using the terraform EKS module, how do you use GPU nodes?

The EKS docs suggest that GPU support is automatic, but some guides/tutorials suggest that the user has to install the nvidia-device-plugin and configure AMIs themselves?

Upvotes: 3

Views: 1881

Answers (1)

Jethro
Jethro

Reputation: 3329

You need to tell the worker groups to use a specific AMI image, and install the NVIDIA device plugin.

There is an image_id property for the worker_groups block.

Find the appropriate AMI image here, selecting the x86 accelerated link under the appropriate kubernetes version and AWS region for your cluster. Copy the AMI id, eg for k8s 1.18 in eu-west-2 you need ami-027a09e5aa5a67e59.

Then plug in your AMI id as image_id in your worker_groups config eg:

module "eks" {
  worker_groups = [
    {
      image_id = "ami-027a09e5aa5a67e59"
    }
  ]
}

Finally, you need to install the nvidia-device-plugin, which could be performed within terraform using the helm provider:

resource "helm_release" "k8s-device-plugin" {
  name  = "k8s-device-plugin"
  repository = "https://nvidia.github.io/k8s-device-plugin"
  chart = "nvidia-device-plugin"
  version = "0.6.0"
  namespace = "kube-system"
}

You should now be able to run GPU pods by requesting the nvidia.com/gpu resource type.

Upvotes: 3

Related Questions