-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Title: Add documentation for custom dependencies in RayService and LMCache+Mooncake on Kubernetes #60035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Title: Add documentation for custom dependencies in RayService and LMCache+Mooncake on Kubernetes #60035
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -163,3 +163,13 @@ kubectl port-forward svc/ray-serve-llm-head-svc 8265 | |
|
|
||
| Once forwarded, navigate to the Serve tab on the dashboard to review application status, deployments, routers, logs, and other relevant features. | ||
|  | ||
|
|
||
| ## Add custom dependencies | ||
|
|
||
| To install additional custom packages necessary for the LLM services that can't be directly installed through `runtime_env`, such as KV cache backends, see [Add custom dependencies](kuberay-rayservice-custom-deps) in the RayService user guide. For a complete example, refer to the LMCache and Mooncake integration for distributed KV cache at [Deploy on Kubernetes with LMCache and Mooncake](kv-cache-offloading-guide). | ||
|
|
||
| Download a basic example: | ||
|
|
||
| ```sh | ||
| curl -o ray-serve.extra-dependency.yaml https://raw.githubusercontent.com/ray-project/kuberay/master/ray-operator/config/samples/ray-serve.extra-dependency.yaml | ||
|
||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -296,6 +296,66 @@ helm uninstall kuberay-operator | |
| kubectl delete pod curl | ||
| ``` | ||
|
|
||
| (kuberay-rayservice-custom-deps)= | ||
| ## Add custom dependencies | ||
|
|
||
| You may need to install additional packages in your Ray containers. KubeRay supports two approaches depending on whether dependencies are shared across all applications or specific to one. | ||
|
|
||
| ### Install shared dependencies via args | ||
|
|
||
| Use the `args` field to install system packages and Python dependencies that all applications in the RayService need. These packages install at container startup and are accessible to every application: | ||
|
|
||
| ```yaml | ||
| workerGroupSpecs: | ||
| - groupName: worker-group | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: ray-worker | ||
| image: rayproject/ray:2.53.0-py312-cu129-aarch64 | ||
| args: | ||
| - | | ||
| sudo apt-get update && \ | ||
| sudo apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \ | ||
| sudo rm -rf /var/lib/apt/lists/* && \ | ||
| pip install opencv-python-headless pillow | ||
| ``` | ||
|
|
||
| You can also install Python packages via `runtime_env`, but using `args` makes them available to all applications and avoids repeated installation. | ||
|
|
||
| ### Install application-specific dependencies via runtime_env | ||
|
|
||
| For dependencies that only a specific application needs, use `runtime_env` in your Serve configuration. This approach lets you install different packages for different applications: | ||
|
|
||
| ```yaml | ||
| serveConfigV2: | | ||
| applications: | ||
| - name: ml_app | ||
| import_path: ml_module:app | ||
| runtime_env: | ||
| pip: | ||
| - pandas | ||
| - scikit-learn | ||
| - name: nlp_app | ||
| import_path: nlp_module:app | ||
| runtime_env: | ||
| pip: | ||
| - transformers | ||
| - tokenizers | ||
| ``` | ||
|
|
||
| Download a complete example combining both approaches: | ||
|
|
||
| ```sh | ||
| curl -o ray-serve.extra-dependency.yaml https://raw.githubusercontent.com/ray-project/kuberay/master/ray-operator/config/samples/ray-serve.extra-dependency.yaml | ||
|
||
| ``` | ||
|
|
||
| :::{note} | ||
| Packages installed via `args` install on every container restart. For production, consider building a custom image with shared dependencies pre-installed. | ||
| ::: | ||
|
|
||
| For advanced container command customization, see [Specify container commands](kuberay-pod-command). | ||
|
|
||
| ## Next steps | ||
|
|
||
| * See [RayService high availability](kuberay-rayservice-ha) for more details on RayService HA. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The URL in this
curlcommand points to a file that doesn't seem to exist in themasterbranch of theray-project/kuberayrepository. This will cause the example command to fail for users. Please verify the URL and update it to a valid location.