README.md 3.08 KB
Newer Older
1
2
3
4
# Examples of using Dynamo Platform

## Serving examples locally

5
Follow individual examples under components/backends/ to serve models locally.
6

7
8
9
For example follow the [vLLM Backend Example](../../components/backends/vllm/README.md)

For a basic GPU - unaware example see the [Hello World Example](../../examples/runtime/hello_world/README.md)
10
11
12
13
14
15
16
17
18
19

## Deploying Examples to Kubernetes

First you need to install the Dynamo Cloud Platform. Dynamo Cloud acts as an orchestration layer between the end user and Kubernetes, handling the complexity of deploying your graphs for you.
Before you can deploy your graphs, you need to deploy the Dynamo Runtime and Dynamo Cloud images. This is a one-time action, only necessary the first time you deploy a DynamoGraph.

### Instructions for Dynamo User
If you are a **👤 Dynamo User** first follow the [Quickstart Guide](../guides/dynamo_deploy/quickstart.md) first.

### Instructions for Dynamo Contributor
20
21
22
If you are a **🧑‍💻 Dynamo Contributor** you may have to rebuild the dynamo platform images as the code evolves.
For more details read the [Cloud Guide](../guides/dynamo_deploy/dynamo_cloud.md)
Read more on deploying Dynamo Cloud read [deploy/cloud/helm/README.md](../../deploy/cloud/helm/README.md).
23
24


25
### Deploying a particular example
26
27
28
29
30
31
32
33

```bash
# Set your dynamo root directory
cd <root-dynamo-folder>
export PROJECT_ROOT=$(pwd)
export NAMESPACE=<your-namespace> # the namespace you used to deploy Dynamo cloud to.
```

34
Deploying an example consists of the simple `kubectl apply -f ... -n ${NAMESPACE}` command. For example:
35

36
```bash
37
kubectl apply -f components/backends/vllm/deploy/agg.yaml -n ${NAMESPACE}
38
39
40
41
42
```

You can use `kubectl get dynamoGraphDeployment -n ${NAMESPACE}` to view your deployment.
You can use `kubectl delete dynamoGraphDeployment <your-dep-name> -n ${NAMESPACE}` to delete the deployment.

43
44
45
We provide a Custom Resource yaml file for many examples under the `deploy/` folder.
Use [VLLM YAML](../../components/backends/vllm/deploy/agg.yaml) for an example.

46
47
48

**Note 1** Example Image

49
The examples use a prebuilt image from the `nvcr.io` registry.
50
You can build your own image and update the image location in your CR file prior to applying.
51
52
53
54
55
56
57
58
59
60
61
62
You could build your own image using

```bash
./container/build.sh --framework <your-inference-framework>
```

For example for the `sglang` run
```bash
./container/build.sh --framework sglang
```

Then you would need to overwrite the image in the examples.
63
64

```bash
65
66
67
extraPodSpec:
        mainContainer:
          image: <image-in-your-$DYNAMO_IMAGE>
68
69
```

70
71
72
73
74
75
76
77
78
79
**Note 2**
Setup port forward if needed when deploying to Kubernetes.

List the services in your namespace:

```bash
kubectl get svc -n ${NAMESPACE}
```
Look for one that ends in `-frontend` and use it for port forward.

80
```bash
81
SERVICE_NAME=$(kubectl get svc -n ${NAMESPACE} -o name | grep frontend | sed 's|.*/||' | sed 's|-frontend||' | head -n1)
82
kubectl port-forward svc/${SERVICE_NAME}-frontend 8080:8080 -n ${NAMESPACE}
83
84
```

85
86
Consult the [Port Forward Documentation](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)

87