|
| 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