Deployment on Google Kubernetes Engine

You can use the API Deployer Kubernetes integration to deploy your API Services on Google Kubernetes Engine.

Setup

Create your GKE cluster

Follow Google documentation on how to create your cluster. We recommend that you allocate at least 7 GB of memory for each cluster node.

Prepare your local docker and kubectl commands

Follow Google documentation to make sure that:

  • Your local (on the DSS machine) kubectl command can interact with the cluster
  • Your local (on the DSS machine) docker command can successfully push images to the gcr.io repository

Setup the infrastructure

Follow the usual setup steps as indicated in Setting up.

On GKE, there is only a single shared image repository URL, gcr.io. Access control is based on images names. Therefore, all images pushed by API Deployer must be prefixed by <GCP project name>/

For example, if your GCP project is called my-gke-project, all images must be prefixe by my-gke-project/. In addition, we recommend that you add a prefix specific to API Deployer

  • Go to the infrastructure settings > Kubernetes cluster
  • In the repository field, enter gcr.io
  • In the images prefix field, enter my-gke-project/dataiku-mad/

Deploy

You’re now ready to deploy your API Services to GKE

Using GPUs

Google Cloud Platform provides GPU-enabled instances with NVidia GPUs. Several steps are required in order to use them for API Deployer deployments

Build a CUDA-enabled base image

The base image that is built by default (see Setting up) does not have CUDA support and cannot use NVidia GPUs.

You need to build a CUDA-enabled base image. We recommend that you give this image a specific tag and keep the default base image “pristine”. We recommend that you add the DSS version number in the image tag.

From the DSS Datadir, run

# -c 1 enables cuda
# -t TAG sets the generated image tag

./bin/dssadmin build-mad-kubernetes-base-image -c 1 -t dataiku-api-deployer-base-cuda:X.Y.Z

where X.Y.Z is your DSS version number

Warning

After each upgrade of DSS, you must rebuild all base images

Then go to the infrastructure settings, and in the “Base image tag” field, enter dataiku-api-deployer-base-cuda:X.Y.Z

Note

This image contains CUDA 9.0 and CuDNN 7.0

Create a cluster with GPUs

Follow google documentation for how to create a cluster with GPU accelerators (Note: you can also create a GPU-enabled node group in an existing cluster)

Don’t forget to run the “daemonset” installation procedure. This procedure needs several minutes to complete.

Add a custom reservation

In order for your API Deployer deployments to be located on nodes with GPU accelerators, and for GKE to configure the CUDA driver on your containers, the corresponding GKE pods must be created with a custom “limit” (in Kubernetes) parlance to indicate that you need a specific type of resource (standard resource types are CPU and Memory)

You can configure this limit either at the infrastructure level (all deployments on this infrastructure will use GPUs) or at the deployment level.

At the infrastructure level

  • Go to Infrastructure > Settings
  • Go to Sizing and Scaling
  • In the “Custom limits” section, add a new entry with key: nvidia.com/gpu and value: 1 (to request 1 GPU)
  • Don’t forget to add the new entry, save settings

At the deployment level

  • Go to Deployment > Settings
  • Go to Sizing and Scaling
  • Enable override of infrastructure settings in the “Container limits” section
  • In the “Custom limits” section, add a new entry with key: nvidia.com/gpu and value: 1 (to request 1 GPU)
  • Don’t forget to add the new entry, save settings

Deploy

You can now deploy your GPU-requiring deployments

This applies to:

  • Python functions (your endpoint needs to use a code environment that includes a CUDA-using package like tensorflow-gpu)
  • Python predictions (ditto)