Repository navigation
Example file for docker compose and k8s #1006
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
Changes from 4 commits
b596d00
211cf7f
652f2a0
0b082f5
1ca561d
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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| services: | ||
| sglang: | ||
| image: lmsysorg/sglang:latest | ||
| container_name: sglang | ||
| volumes: | ||
| - ${HOME}/.cache/huggingface:/root/.cache/huggingface | ||
| restart: always | ||
| network_mode: host | ||
| # Or you can only publish port 30000 | ||
| # ports: | ||
| # - 30000:30000 | ||
| environment: | ||
| HF_TOKEN: <secret> | ||
| entrypoint: python3 -m sglang.launch_server | ||
| command: | ||
| --model-path meta-llama/Meta-Llama-3.1-8B-Instruct | ||
|
LucienShui marked this conversation as resolved.
Resolved
|
||
| --host 0.0.0.0 | ||
| --port 30000 | ||
| ulimits: | ||
| memlock: -1 | ||
| stack: 67108864 | ||
| ipc: host | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "curl -f http://localhost:30000/health || exit 1"] | ||
| deploy: | ||
| resources: | ||
| reservations: | ||
| devices: | ||
| - driver: nvidia | ||
| device_ids: ['0'] | ||
| capabilities: [gpu] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| apiVersion: node.k8s.io/v1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May we add health check, image pull policy and network policy?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I've just started learning k8s for 4 days, after searching, I still have no idea about what the network policy should do here. Health check and pull policy was added.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's basically done, and I currently don't have the appropriate environment. It might need to wait for another reviewer to do a simple local verification. Thank you for your contribution!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| kind: RuntimeClass | ||
| metadata: | ||
| name: nvidia | ||
| handler: nvidia | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: meta-llama-31-8b-instruct-sglang | ||
| spec: | ||
| replicas: 1 | ||
| strategy: | ||
| type: Recreate | ||
| selector: | ||
| matchLabels: | ||
| app: meta-llama-31-8b-instruct-sglang | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: meta-llama-31-8b-instruct-sglang | ||
| model: meta-llama-31-8b-instruct | ||
| engine: sglang | ||
| spec: | ||
| hostIPC: true | ||
| restartPolicy: Always | ||
| runtimeClassName: nvidia | ||
| containers: | ||
| - name: meta-llama-31-8b-instruct-sglang | ||
| image: docker.io/lmsysorg/sglang:latest | ||
| imagePullPolicy: Always # IfNotPresent or Never | ||
| ports: | ||
| - containerPort: 30000 | ||
| command: ["python3", "-m", "sglang.launch_server"] | ||
| args: ["--model-path", "meta-llama/Meta-Llama-3.1-8B-Instruct", "--host", "0.0.0.0", "--port", "30000"] | ||
| env: | ||
| - name: HF_TOKEN | ||
| value: <secret> | ||
| resources: | ||
| limits: | ||
| nvidia.com/gpu: 1 | ||
| volumeMounts: | ||
| - name: hf-cache | ||
| mountPath: /root/.cache/huggingface | ||
| readOnly: true | ||
| - name: localtime | ||
| mountPath: /etc/localtime | ||
| readOnly: true | ||
| livenessProbe: | ||
| httpGet: | ||
| path: /health | ||
| port: 30000 | ||
| initialDelaySeconds: 30 | ||
| periodSeconds: 10 | ||
| volumes: | ||
| - name: hf-cache | ||
| hostPath: | ||
| path: /root/.cache/huggingface | ||
| type: Directory | ||
| - name: localtime | ||
| hostPath: | ||
| path: /etc/localtime | ||
| type: File | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: meta-llama-31-8b-instruct-sglang | ||
| spec: | ||
| selector: | ||
| app: meta-llama-31-8b-instruct-sglang | ||
| ports: | ||
| - protocol: TCP | ||
| port: 30000 # port on host | ||
| targetPort: 30000 # port in container | ||
| type: LoadBalancer | ||
Uh oh!
There was an error while loading. Please reload this page.