Skip to content

Commit 3983830

Browse files
hutmnvda-mesharma
andauthored
fix: created documentation to deploy_to_k8s_using_helm (#245)
Co-authored-by: Meenakshi Sharma <[email protected]>
1 parent 93a4696 commit 3983830

File tree

5 files changed

+141
-2
lines changed

5 files changed

+141
-2
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
replicaCount: 1
17+
# Explicitly remove authentication
18+
auth:
19+
rbac:
20+
create: false
21+
22+
readinessProbe:
23+
enabled: false
24+
25+
livenessProbe:
26+
enabled: false
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
config:
17+
jetstream:
18+
enabled: true
19+
fileStore:
20+
enabled: true
21+
dir: /data
22+
pvc:
23+
enabled: true
24+
size: 10Gi
25+
storageClassName:

deploy/dynamo/sdk/src/dynamo/sdk/cli/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def create_bentoml_cli() -> click.Command:
3232
from dynamo.sdk.cli.serve import serve_command
3333

3434
# from dynamo.sdk.cli.server import cloud_command
35-
# from dynamo.sdk.cli.start import start_command
35+
from dynamo.sdk.cli.start import start_command
3636
from dynamo.sdk.cli.utils import DynamoCommandGroup
3737

3838
server_context.service_type = "cli"
@@ -54,7 +54,8 @@ def bentoml_cli(): # TODO: to be renamed to something....
5454
# Add top-level CLI commands
5555
# bentoml_cli.add_command(cloud_command)
5656
bentoml_cli.add_single_command(bento_command, "build")
57-
# bentoml_cli.add_subcommands(start_command)
57+
bentoml_cli.add_subcommands(start_command)
58+
bentoml_cli.add_single_command(bento_command, "get")
5859
bentoml_cli.add_subcommands(serve_command)
5960
bentoml_cli.add_subcommands(run_command)
6061
# bentoml_cli.add_command(containerize_command)

deploy/dynamo/sdk/src/dynamo/sdk/cli/start.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def cli():
157157
help="Print the final service configuration and exit without starting the server",
158158
default=False,
159159
)
160+
@click.pass_context
160161
@add_experimental_docstring
161162
def start(
162163
ctx: click.Context,
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
First install microk8s:
2+
3+
```bash
4+
sudo snap install microk8s --classic
5+
```
6+
7+
add user permissions
8+
```bash
9+
sudo usermod -a -G microk8s $USER
10+
sudo chown -R $USER ~/.kube
11+
```
12+
13+
Log out and log in
14+
15+
start microk8s
16+
```
17+
microk8s start
18+
```
19+
20+
Add GPU support
21+
```
22+
microk8s enable gpu
23+
```
24+
25+
Add storage support (follow https://microk8s.io/docs/addon-hostpath-storage)
26+
```
27+
microk8s enable storage
28+
```
29+
30+
Kube config
31+
```
32+
mkdir -p ~/.kube && microk8s config >> ~/.kube/config
33+
```
34+
35+
Now one can use `kubectl` command.
36+
37+
2. create a namespace
38+
39+
```
40+
export NAMESPACE=dynamo-playground
41+
export RELEASE_NAME=dynamo-platform
42+
43+
#install nats and etcd
44+
cd deploy/Kubernetes/pipeline/dependencies
45+
46+
#install nats
47+
helm repo add nats https://nats-io.github.io/k8s/helm/charts/
48+
helm repo update
49+
helm install --namespace ${NAMESPACE} dynamo-platform-nats nats/nats --create-namespace --values nats-values.yaml
50+
51+
#install etcd
52+
helm install --namespace ${NAMESPACE} dynamo-platform-etcd oci://registry-1.docker.io/bitnamicharts/etcd --values etcd-values.yaml
53+
```
54+
55+
Now let's containerize a hello world pipeline:
56+
1. Build container image for `container/Dockerfile.vllm`
57+
2. Containerize hello world pipeline
58+
```
59+
cd examples/hello_world
60+
export DYNAMO_IMAGE=<dynamo_runtime_image_name>
61+
dynamo build --containerize hello_world:Frontend
62+
```
63+
64+
Once the container is built, it has to be tagged and pushed to container registry:
65+
```
66+
docker tag <BUILT_IMAGE_TAG> <TAG>
67+
docker push <TAG>
68+
```
69+
70+
Now one can deploy the pipeline onto k8s using helm
71+
- get values.yaml for helm chart:
72+
- install chart
73+
```
74+
export HELM_RELEASE=helloworld
75+
dynamo get frontend > pipeline-values.yaml
76+
77+
helm upgrade -i "$HELM_RELEASE" ./chart -f pipeline-values.yaml --set image=<TAG> --set dynamoIdentifier="hello_world:Frontend" -n "$NAMESPACE"
78+
```
79+
80+
Once the deployments are running, one can port-forward to localhost and make API calls to the frontend component:
81+
```
82+
kubectl -n ${NAMESPACE} port-forward svc/helloworld-frontend 3000:80
83+
curl -X 'POST' 'http://localhost:3000/generate' -H 'accept: text/event-stream' -H 'Content-Type: application/json' -d '{"text": "test"}'
84+
```
85+
86+
Full script to build a container, push it to registry and deploya helm chart: `deploy/Kubernetes/pipeline/deploy.sh`

0 commit comments

Comments
 (0)