From 37b4dde7fd3ade2eae5a5f5c6dcc11fed5e0d1a3 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Sat, 9 Mar 2024 02:24:07 +0100 Subject: [PATCH 1/2] Add quickstart deploy with k8s --- docs/my-website/docs/proxy/deploy.md | 64 ++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/docs/my-website/docs/proxy/deploy.md b/docs/my-website/docs/proxy/deploy.md index 4b51f094cb8..b2e48d5229f 100644 --- a/docs/my-website/docs/proxy/deploy.md +++ b/docs/my-website/docs/proxy/deploy.md @@ -68,6 +68,70 @@ CMD ["--port", "4000", "--config", "config.yaml", "--detailed_debug", "--run_gun + + +Deploying a config file based litellm instance, just requires a simple deployment that loads +the config.yaml file via a config map. + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: litellm-config-file +data: + config.yaml: | + model_list: + - model_name: gpt-3.5-turbo # user-facing model alias + litellm_params: # all params accepted by litellm.completion() - https://docs.litellm.ai/docs/completion/input + model: azure/ + api_base: + api_key: + - model_name: gpt-3.5-turbo + litellm_params: + model: azure/gpt-turbo-small-ca + api_base: https://my-endpoint-canada-berri992.openai.azure.com/ + api_key: + - model_name: vllm-model + litellm_params: + model: openai/ + api_base: # e.g. http://0.0.0.0:3000 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: litellm-deployment + labels: + app: litellm +spec: + selector: + matchLabels: + app: litellm + template: + metadata: + labels: + app: litellm + spec: + containers: + - name: litellm + image: ghcr.io/berriai/litellm:main-latest # it is recommended to fix a version generally + ports: + - containerPort: 4000 + volumeMounts: + - name: config-volume + mountPath: /app/proxy_server_config.yaml + subPath: config.yaml + envFrom: + - secretRef: + name: litellm-secrets + volumes: + - name: config-volume + configMap: + name: litellm-config-file + +``` + + + ## Deploy with Database From bb427b465982905a54c4a5b836ae9aab93cdbe8f Mon Sep 17 00:00:00 2001 From: Guillermo Date: Sat, 9 Mar 2024 02:30:17 +0100 Subject: [PATCH 2/2] Update deploy.md --- docs/my-website/docs/proxy/deploy.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/my-website/docs/proxy/deploy.md b/docs/my-website/docs/proxy/deploy.md index b2e48d5229f..0ce9c0005b2 100644 --- a/docs/my-website/docs/proxy/deploy.md +++ b/docs/my-website/docs/proxy/deploy.md @@ -70,8 +70,9 @@ CMD ["--port", "4000", "--config", "config.yaml", "--detailed_debug", "--run_gun -Deploying a config file based litellm instance, just requires a simple deployment that loads -the config.yaml file via a config map. +Deploying a config file based litellm instance just requires a simple deployment that loads +the config.yaml file via a config map. Also it would be a good practice to use the env var +declaration for api keys, and attach the env vars with the api key values as an opaque secret. ```yaml apiVersion: v1 @@ -81,20 +82,19 @@ metadata: data: config.yaml: | model_list: - - model_name: gpt-3.5-turbo # user-facing model alias - litellm_params: # all params accepted by litellm.completion() - https://docs.litellm.ai/docs/completion/input - model: azure/ - api_base: - api_key: - model_name: gpt-3.5-turbo litellm_params: model: azure/gpt-turbo-small-ca api_base: https://my-endpoint-canada-berri992.openai.azure.com/ - api_key: - - model_name: vllm-model - litellm_params: - model: openai/ - api_base: # e.g. http://0.0.0.0:3000 + api_key: os.environ/CA_AZURE_OPENAI_API_KEY +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: litellm-secrets +data: + CA_AZURE_OPENAI_API_KEY: bWVvd19pbV9hX2NhdA== # your api key in base64 --- apiVersion: apps/v1 kind: Deployment @@ -127,7 +127,6 @@ spec: - name: config-volume configMap: name: litellm-config-file - ```