Skip to content

Commit f4f14bc

Browse files
Merge pull request kubernetes-sigs#40 from shaneutt/kubernetes-dev-env
feat: add kubernetes dev env
2 parents 9df4be1 + 6bedb47 commit f4f14bc

17 files changed

+331
-310
lines changed

DEVELOPMENT.md

+133-3
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,138 @@ recent changes are refleted.
6666

6767
## Kubernetes
6868

69-
WIP
69+
A Kubernetes (or OpenShift) cluster can be used for development and testing.
70+
There is a cluster-level infrastructure deployment that needs to be managed,
71+
and then development environments can be created on a per-namespace basis to
72+
enable sharing the cluster with multiple developers if desired.
7073

71-
## OpenShift
74+
### Setup - Infrastructure
7275

73-
WIP
76+
> **WARNING**: In shared cluster situations you should probably not be
77+
> running this unless you're the cluster admin and you're _certain_ it's you
78+
> that should be running this.
79+
80+
The following will deploy all the infrastructure-level requirements (e.g. CRDs,
81+
Operators, etc) to support the namespace-level development environments:
82+
83+
```console
84+
make environment.dev.kubernetes.infrastructure
85+
```
86+
87+
When the `deploy/environments/dev/kubernetes-infra` deployment's components are
88+
updated, this will need to be re-deployed.
89+
90+
### Setup - Developer Environment
91+
92+
> **WARNING**: This setup is currently very manual in regards to container
93+
> images for the VLLM simulator and the EPP. It is expected that you build and
94+
> push images for both to your own private registry. In future iterations, we
95+
> will be automating this further to make it simpler.
96+
97+
To deploy a development environment to the cluster you'll need to explicitly
98+
provide a namespace. This can be `default` if this is your personal cluster,
99+
but on a shared cluster you should pick something unique. For example:
100+
101+
```console
102+
export NAMESPACE=annas-dev-environment
103+
```
104+
105+
Create the namespace:
106+
107+
```console
108+
kubectl create namespace ${NAMESPACE}
109+
```
110+
111+
You'll need to provide a `Secret` with the login credentials for your private
112+
repository (e.g. quay.io). It should look something like this:
113+
114+
```yaml
115+
apiVersion: v1
116+
kind: Secret
117+
metadata:
118+
name: anna-pull-secret
119+
data:
120+
.dockerconfigjson: <YOUR_TOKEN_HERE>
121+
type: kubernetes.io/dockerconfigjson
122+
```
123+
124+
Apply that to your namespace:
125+
126+
```console
127+
kubectl -n ${NAMESPACE} apply -f secret.yaml
128+
```
129+
130+
Export the name of the secret to the environment:
131+
132+
```console
133+
export REGISTRY_SECRET=anna-pull-secret
134+
```
135+
136+
Now you need to provide several other environment variables. You'll need to
137+
indicate the location and tag of the `vllm-sim` image:
138+
139+
```console
140+
export VLLM_SIM_IMAGE="<YOUR_REGISTRY>/<YOUR_IMAGE>"
141+
export VLLM_SIM_TAG="<YOUR_TAG>"
142+
```
143+
144+
The same thing will need to be done for the EPP:
145+
146+
```console
147+
export EPP_IMAGE="<YOUR_REGISTRY>/<YOUR_IMAGE>"
148+
export EPP_TAG="<YOUR_TAG>"
149+
```
150+
151+
Once all this is set up, you can deploy the environment:
152+
153+
```console
154+
make environment.dev.kubernetes
155+
```
156+
157+
This will deploy the entire stack to whatever namespace you chose. You can test
158+
by exposing the inference `Gateway` via port-forward:
159+
160+
```console
161+
kubectl -n ${NAMESPACE} port-forward service/inference-gateway-istio 8080:80
162+
```
163+
164+
And making requests with `curl`:
165+
166+
```console
167+
curl -s -w '\n' http://localhost:8080/v1/completions -H 'Content-Type: application/json' -d '{"model":"food-review","prompt":"hi","max_tokens":10,"temperature":0}' | jq
168+
```
169+
170+
#### Development Cycle
171+
172+
> **WARNING**: This is a very manual process at the moment. We expect to make
173+
> this more automated in future iterations.
174+
175+
Make your changes locally and commit them. Then select an image tag based on
176+
the `git` SHA:
177+
178+
```console
179+
export EPP_TAG=$(git rev-parse HEAD)
180+
```
181+
182+
Build the image:
183+
184+
```console
185+
DEV_VERSION=$EPP_TAG make image-build
186+
```
187+
188+
Tag the image for your private registry and push it:
189+
190+
```console
191+
$CONTAINER_RUNTIME tag quay.io/vllm-d/gateway-api-inference-extension/epp:$TAG \
192+
<MY_REGISTRY>/<MY_IMAGE>:$EPP_TAG
193+
$CONTAINER_RUNTIME push <MY_REGISTRY>/<MY_IMAGE>:$EPP_TAG
194+
```
195+
196+
Then you can re-deploy the environment with the new changes (don't forget all
197+
the required env vars):
198+
199+
```console
200+
make environment.dev.kubernetes
201+
```
202+
203+
And test the changes.

0 commit comments

Comments
 (0)