This directory contains a configmap containing lora adapters configurations and script for a sidecar container to dynamically manage LORA adapters for a vLLM server running in the same Kubernetes pod by reconciling it with a configmap containing lora adapters.
The sidecar continuously monitors a ConfigMap mounted as a YAML configuration file. This file defines the desired state of LORA adapters, including:
- Adapter ID: Unique identifier for the adapter.
- Source: Path to the adapter's source files.
- Base Model: The base model to which the adapter should be applied.
- toRemove: (Optional) Indicates whether the adapter should be unloaded.
The sidecar uses the vLLM server's API to load or unload adapters based on the configuration. It also periodically reconciles the registered adapters on the vLLM server with the desired state defined in the ConfigMap, ensuring consistency.
- Dynamic Loading and Unloading: Load and unload LORA adapters without restarting the vLLM server.
- Continuous Reconciliation: Ensures the vLLM server's state matches the desired configuration.
- ConfigMap Integration: Leverages Kubernetes ConfigMaps for easy configuration management.
- Easy Deployment: Provides a sample deployment YAML for quick setup.
sidecar.py
: Python script for the sidecar container.Dockerfile
: Dockerfile to build the sidecar image.configmap.yaml
: Example ConfigMap YAML file.deployment.yaml
: Example Kubernetes deployment YAML.
- Build the Docker Image:
docker build -t <your-image-name> .
- Create a configmap:
kubectl create configmap name-of-your-configmap --from-file=your-file.yaml
- Mount the configmap and configure sidecar in your pod
Do not use subPath, since configmap updates are not reflected in the file
volumeMounts: # DO NOT USE subPath - name: config-volume mountPath: /config
[deployment]: deployment.yaml it uses sidecar(initContainer
with restartPolicy
set to always
) which is beta feature enabled by default since k8s version 1.29. They need to be enabled in 1.28 and prior to 1.28 sidecar are not officially supported.
vLLMLoRAConfig
[required] base keyhost
[optional]Model server's host. defaults to localhostport
[optional] Model server's port. defaults to 8000name
[optional] Name of this configensureExist
[optional] List of models to ensure existence on specified model server.models
[required] [list]base-model
[optional] Base model for lora adapterid
[required] unique id of lora adaptersource
[required] path (remote or local) to lora adapter
ensureNotExist
[optional]models
[required] [list]id
[required] unique id of lora adaptersource
[required] path (remote or local) to lora adapterbase-model
[optional] Base model for lora adapter
I tested the sidecar in my cluster with deployment and configmap specified in this repo. Here are the screen grabs of the logs from the sidecar and vllm server. I used the specified configmap, verified that the adapters were loaded by querying v1/models
and looking at vllm logs. I changed the configmap and validated the same on vllm server. Note: There is slight lag between updates.