mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
Update dev_config.yaml and Helm chart dependencies for performance-eks deployment
- Added new configuration options in dev_config.yaml, including health check details and database URL. - Updated PostgreSQL and Redis dependencies in Chart.lock to newer versions (PostgreSQL 18.6.1, Redis 25.3.12). - Introduced new Kubernetes deployment files for performance-eks, including configurations for LiteLLM, mock LLM provider, and Prometheus. - Added README.md for performance-related deployment assets.
This commit is contained in:
parent
0b50a29baf
commit
4b269c0ac4
10 changed files with 376 additions and 0 deletions
34
deploy/kubernetes/performance-eks/dev-config.yaml
Normal file
34
deploy/kubernetes/performance-eks/dev-config.yaml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Proxy config for performance-eks: Neon (DATABASE_URL from Secret) + in-memory cache (no Redis).
|
||||
# DB URL and master key must come from env — see README (litellm-dotenv Secret).
|
||||
|
||||
model_list:
|
||||
- model_name: fake-openai-endpoint
|
||||
litellm_params:
|
||||
model: openai/fake-model
|
||||
api_key: fake-key
|
||||
api_base: https://exampleopenaiendpoint-production.up.railway.app/
|
||||
timeout: 40
|
||||
|
||||
- model_name: fake-openai-gpt4
|
||||
litellm_params:
|
||||
model: gpt-4
|
||||
api_key: fake-key
|
||||
api_base: http://mock-llm-provider/llm/
|
||||
|
||||
general_settings:
|
||||
master_key: os.environ/PROXY_MASTER_KEY
|
||||
health_check_details: False
|
||||
database_url: os.environ/DATABASE_URL
|
||||
|
||||
litellm_settings:
|
||||
network_mock: False
|
||||
json_logs: True
|
||||
drop_params: True
|
||||
telemetry: False
|
||||
callbacks: ["prometheus"]
|
||||
public_routes: ["LiteLLMRoutes.public_routes", "/health/liveliness"]
|
||||
num_retries: 0
|
||||
cache: True
|
||||
cache_params:
|
||||
type: local
|
||||
supported_call_types: []
|
||||
20
deploy/kubernetes/performance-eks/eksctl-cluster.yaml
Normal file
20
deploy/kubernetes/performance-eks/eksctl-cluster.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# EKS cluster — single worker node. Safe to commit (no secrets).
|
||||
#
|
||||
# Create: eksctl create cluster -f deploy/kubernetes/performance-eks/eksctl-cluster.yaml
|
||||
# Delete: eksctl delete cluster -f deploy/kubernetes/performance-eks/eksctl-cluster.yaml
|
||||
#
|
||||
# To allow more nodes later: raise maxSize (and desiredCapacity), then scale or upgrade.
|
||||
|
||||
apiVersion: eksctl.io/v1alpha5
|
||||
kind: ClusterConfig
|
||||
|
||||
metadata:
|
||||
name: litellm-perf
|
||||
region: us-east-1
|
||||
|
||||
managedNodeGroups:
|
||||
- name: workers
|
||||
instanceType: t3.xlarge
|
||||
desiredCapacity: 1
|
||||
minSize: 1
|
||||
maxSize: 1
|
||||
27
deploy/kubernetes/performance-eks/kustomization.yaml
Normal file
27
deploy/kubernetes/performance-eks/kustomization.yaml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Apply from repo root:
|
||||
# kubectl kustomize deploy/kubernetes/performance-eks --load-restrictor=LoadRestrictionsNone | kubectl apply -f -
|
||||
#
|
||||
# Requires Secret litellm-dotenv with DATABASE_URL (Neon) and PROXY_MASTER_KEY — see README.
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: performance-eks
|
||||
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- litellm-static-env.yaml
|
||||
- mock-llm.yaml
|
||||
- mock-files-api.yaml
|
||||
- prometheus.yaml
|
||||
- litellm.yaml
|
||||
|
||||
configMapGenerator:
|
||||
- name: dev-config
|
||||
files:
|
||||
- config.yaml=dev-config.yaml
|
||||
- name: prometheus-config
|
||||
files:
|
||||
- prometheus.yml=../../../prometheus.yml
|
||||
|
||||
generatorOptions:
|
||||
disableNameSuffixHash: true
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Non-secret env. DATABASE_URL + PROXY_MASTER_KEY: set via Secret litellm-dotenv (required).
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: litellm-static-env
|
||||
data:
|
||||
STORE_MODEL_IN_DB: "True"
|
||||
ENV: "production"
|
||||
LITELLM_ENVIRONMENT: "production"
|
||||
84
deploy/kubernetes/performance-eks/litellm.yaml
Normal file
84
deploy/kubernetes/performance-eks/litellm.yaml
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: litellm
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 4000
|
||||
targetPort: 4000
|
||||
selector:
|
||||
app: litellm
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: litellm
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: litellm
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: litellm
|
||||
spec:
|
||||
containers:
|
||||
- name: litellm
|
||||
image: ghcr.io/berriai/litellm:v1.83.3-stable
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- "--host"
|
||||
- "0.0.0.0"
|
||||
- "--config"
|
||||
- "/app/config.yaml"
|
||||
- "--port"
|
||||
- "4000"
|
||||
- "--num_workers"
|
||||
- "2"
|
||||
- "--max_requests_before_restart"
|
||||
- "20000"
|
||||
ports:
|
||||
- containerPort: 4000
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: litellm-static-env
|
||||
- secretRef:
|
||||
name: litellm-dotenv
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /app/config.yaml
|
||||
subPath: config.yaml
|
||||
readOnly: true
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- SYS_PTRACE
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health/readiness
|
||||
port: 4000
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health/liveliness
|
||||
port: 4000
|
||||
initialDelaySeconds: 45
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
requests:
|
||||
cpu: "500m"
|
||||
memory: "1Gi"
|
||||
limits:
|
||||
cpu: "4"
|
||||
memory: "4Gi"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: dev-config
|
||||
71
deploy/kubernetes/performance-eks/mock-files-api.yaml
Normal file
71
deploy/kubernetes/performance-eks/mock-files-api.yaml
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# Minimal OpenAI-shaped mock + /health (compose used repo mock_files_api.py on a volume).
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mock-files-api-code
|
||||
data:
|
||||
mock_files_api.py: |
|
||||
"""Minimal files/OpenAI mock for k8s parity; extend to match your local mock_files_api.py."""
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
return {"status": "ok"}
|
||||
|
||||
@app.get("/v1/models")
|
||||
def models():
|
||||
return {"object": "list", "data": []}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mock-files-api
|
||||
spec:
|
||||
ports:
|
||||
- port: 8001
|
||||
targetPort: 8001
|
||||
selector:
|
||||
app: mock-files-api
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mock-files-api
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mock-files-api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mock-files-api
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: python:3.11-slim
|
||||
workingDir: /app
|
||||
ports:
|
||||
- containerPort: 8001
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- pip install --no-cache-dir fastapi uvicorn && uvicorn mock_files_api:app --host 0.0.0.0 --port 8001
|
||||
volumeMounts:
|
||||
- name: code
|
||||
mountPath: /app/mock_files_api.py
|
||||
subPath: mock_files_api.py
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8001
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 12
|
||||
volumes:
|
||||
- name: code
|
||||
configMap:
|
||||
name: mock-files-api-code
|
||||
36
deploy/kubernetes/performance-eks/mock-llm.yaml
Normal file
36
deploy/kubernetes/performance-eks/mock-llm.yaml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mock-llm-provider
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: mock-llm-provider
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mock-llm-provider
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mock-llm-provider
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mock-llm-provider
|
||||
spec:
|
||||
containers:
|
||||
- name: httpbun
|
||||
image: sharat87/httpbun:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 3
|
||||
periodSeconds: 5
|
||||
4
deploy/kubernetes/performance-eks/namespace.yaml
Normal file
4
deploy/kubernetes/performance-eks/namespace.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: performance-eks
|
||||
47
deploy/kubernetes/performance-eks/prometheus.yaml
Normal file
47
deploy/kubernetes/performance-eks/prometheus.yaml
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: prometheus
|
||||
spec:
|
||||
ports:
|
||||
- port: 9090
|
||||
targetPort: 9090
|
||||
selector:
|
||||
app: prometheus
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: prometheus
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: prometheus
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: prometheus
|
||||
spec:
|
||||
containers:
|
||||
- name: prometheus
|
||||
image: prom/prometheus
|
||||
args:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus
|
||||
- --storage.tsdb.retention.time=15d
|
||||
ports:
|
||||
- containerPort: 9090
|
||||
volumeMounts:
|
||||
- name: cfg
|
||||
mountPath: /etc/prometheus
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /-/ready
|
||||
port: 9090
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
volumes:
|
||||
- name: cfg
|
||||
configMap:
|
||||
name: prometheus-config
|
||||
44
deploy/performance/README.md
Normal file
44
deploy/performance/README.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# Performance-related deploy assets
|
||||
|
||||
## Full Kustomize stack on EKS (Neon + in-memory cache)
|
||||
|
||||
For **LiteLLM + mock LLM + mock files API + Prometheus** with **Neon** (`DATABASE_URL` Secret) and **in-memory cache**, see **`../kubernetes/performance-eks/`**.
|
||||
|
||||
## LiteLLM on Kubernetes (EKS-friendly, Helm chart)
|
||||
|
||||
`litellm-eks/` mirrors the repo root `docker-compose.yml` layout: single replica, bundled Postgres, `STORE_MODEL_IN_DB`, and Helm migration hooks for plain `helm install`.
|
||||
|
||||
### AWS EKS prerequisites
|
||||
|
||||
- `kubectl` context points at your cluster (`aws eks update-kubeconfig ...`).
|
||||
- A **default StorageClass** (EKS often ships with `gp2` / `gp3` via EBS CSI driver) so the Bitnami Postgres chart can bind PVCs.
|
||||
- For a public proxy URL, either **`kubectl port-forward`**, set **`service.type: LoadBalancer`** in `litellm-eks/values.yaml` (NLB/CLB), or add an **Ingress** + AWS Load Balancer Controller / ALB—see the main Helm chart `ingress` values.
|
||||
|
||||
### Deploy with Helm only
|
||||
|
||||
From the repository root:
|
||||
|
||||
```bash
|
||||
helm dependency update deploy/charts/litellm-helm
|
||||
chmod +x deploy/performance/litellm-eks/install.sh
|
||||
MASTER_KEY='sk-your-key' ./deploy/performance/litellm-eks/install.sh
|
||||
```
|
||||
|
||||
Optional environment variables: `LITELLM_NAMESPACE`, `LITELLM_RELEASE`, `MASTER_KEY`.
|
||||
|
||||
### Deploy with Kustomize + Helm (chart inflator)
|
||||
|
||||
Kustomize renders the same chart; you then apply YAML (no Helm release stored in the cluster).
|
||||
|
||||
```bash
|
||||
helm dependency update deploy/charts/litellm-helm
|
||||
kubectl kustomize deploy/performance/litellm-eks --enable-helm | kubectl apply -f -
|
||||
```
|
||||
|
||||
To pin the proxy master key when using this path, add a local values file and reference it from `litellm-eks/kustomization.yaml` under `helmCharts[].additionalValuesFiles` (keep that file out of git).
|
||||
|
||||
**Note:** `helmCharts[].version` in `kustomization.yaml` must match `version` in `deploy/charts/litellm-helm/Chart.yaml` after chart bumps.
|
||||
|
||||
### Prometheus
|
||||
|
||||
The compose file scrapes `litellm:4000`. In-cluster, point Prometheus at `http://<release>-litellm.<namespace>.svc.cluster.local:4000` (default install: `http://litellm-litellm.litellm.svc.cluster.local:4000`).
|
||||
Loading…
Add table
Reference in a new issue