Tutorial: Set up W&B Launch on Kubernetes
4 minute read
You can use W&B Launch to push ML workloads to a Kubernetes cluster, giving ML engineers a simple interface right in W&B to use the resources you already manage with Kubernetes.
W&B maintains an official Launch agent image that can be deployed to your cluster with a Helm chart that W&B maintains.
W&B uses the Kaniko builder to enable the Launch agent to build Docker images in a Kubernetes cluster. To learn more on how to set up Kaniko for the Launch agent, or how to turn off job building and only use prebuilt Docker images, see Advanced agent set up.
kubectl
access to the cluster with sufficient permissions to create, update, and delete Kubernetes resources. Typically, a user with cluster-admin or a custom role with equivalent permissions is required.Configure a queue for Kubernetes
The Launch queue configuration for a Kubernetes target resource will resemble either a Kubernetes Job spec or a Kubernetes Custom Resource spec.
You can control any aspect of the Kubernetes workload resource spec when you create a Launch queue.
In some use cases, you might want to use CustomResource
definitions. CustomResource
definitions are useful if, for example, you want to perform multi-node distributed training. See the tutorial for using Launch with multi-node jobs using Volcano for an example application. Another use case might be that you want to use W&B Launch with Kubeflow.
The following YAML snippet shows a sample Launch queue config that uses Kubeflow:
For security reasons, W&B will inject the following resources into your Launch queue if they are not specified:
securityContext
backOffLimit
ttlSecondsAfterFinished
The following YAML snippet demonstrates how these values will appear in your launch queue:
Create a queue
Create a queue in the W&B App that uses Kubernetes as its compute resource:
- Navigate to the Launch page.
- Click on the Create Queue button.
- Select the Entity you would like to create the queue in.
- Provide a name for your queue in the Name field.
- Select Kubernetes as the Resource.
- Within the Configuration field, provide the Kubernetes Job workflow spec or Custom Resource spec you configured in the previous section.
Configure a Launch agent with Helm
Use the Helm chart provided by W&B to deploy the Launch agent into your Kubernetes cluster. Control the behavior of the launch agent with the values.yaml
file.
Specify the contents that would normally by defined in your launch agent config file (~/.config/wandb/launch-config.yaml
) within the launchConfig
key in thevalues.yaml
file.
For example, suppose you have Launch agent config that enables you to run a Launch agent in EKS that uses the Kaniko Docker image builder:
Within your values.yaml
file, this might look like:
For more information on registries, environments, and required agent permissions see Advanced agent set up.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.