Skip to content

Commit e74f1d1

Browse files
shmuelkvMaroon
authored andcommitted
Setup the Istio service to be a NodePort service and not a ClusterIP service
1 parent 961fa9b commit e74f1d1

File tree

4 files changed

+52
-6
lines changed

4 files changed

+52
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: gateway.networking.k8s.io/v1
2+
kind: Gateway
3+
metadata:
4+
name: inference-gateway
5+
annotations:
6+
networking.istio.io/service-type: NodePort

deploy/environments/dev/kind/kustomization.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1
1313
kind: Kustomization
1414

1515
resources:
16+
- services.yaml
1617
- ../../../components/istio-control-plane/
1718
- ../../../components/vllm-sim/
1819
- ../../../components/inference-gateway/
20+
21+
patches:
22+
- path: gateway.yaml
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
annotations:
5+
networking.istio.io/service-type: NodePort
6+
labels:
7+
gateway.istio.io/managed: istio.io-gateway-controller
8+
gateway.networking.k8s.io/gateway-name: inference-gateway
9+
istio.io/enable-inference-extproc: "true"
10+
name: inference-gateway-istio
11+
namespace: default
12+
spec:
13+
type: NodePort
14+
selector:
15+
gateway.networking.k8s.io/gateway-name: inference-gateway
16+
ports:
17+
- appProtocol: tcp
18+
name: status-port
19+
port: 15021
20+
protocol: TCP
21+
targetPort: 15021
22+
nodePort: 32021
23+
- appProtocol: http
24+
name: default
25+
port: 80
26+
protocol: TCP
27+
targetPort: 80
28+
nodePort: 30080

scripts/kind-dev-env.sh

+14-6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2222
# Set the namespace to deploy the Gateway stack to
2323
: "${PROJECT_NAMESPACE:=default}"
2424

25+
# Set the host port to map to the Gateway's inbound port (30080)
26+
: "${GATEWAY_HOST_PORT:=30080}"
27+
2528
# ------------------------------------------------------------------------------
2629
# Setup & Requirement Checks
2730
# ------------------------------------------------------------------------------
@@ -63,7 +66,16 @@ done
6366
if kind get clusters 2>/dev/null | grep -q "^${CLUSTER_NAME}$"; then
6467
echo "Cluster '${CLUSTER_NAME}' already exists, re-using"
6568
else
66-
kind create cluster --name "${CLUSTER_NAME}"
69+
kind create cluster --name "${CLUSTER_NAME}" --config - << EOF
70+
kind: Cluster
71+
apiVersion: kind.x-k8s.io/v1alpha4
72+
nodes:
73+
- role: control-plane
74+
extraPortMappings:
75+
- containerPort: 30080
76+
hostPort: ${GATEWAY_HOST_PORT}
77+
protocol: TCP
78+
EOF
6779
fi
6880

6981
# Set the kubectl context to the kind cluster
@@ -126,13 +138,9 @@ You can watch the Endpoint Picker logs with:
126138
127139
$ kubectl --context ${KUBE_CONTEXT} logs -f deployments/endpoint-picker
128140
129-
You can use a port-forward to access the Gateway:
130-
131-
$ kubectl --context ${KUBE_CONTEXT} port-forward service/inference-gateway-istio 8080:80
132-
133141
With that running in the background, you can make requests:
134142
135-
$ 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
143+
$ curl -s -w '\n' http://localhost:${GATEWAY_HOST_PORT}/v1/completions -H 'Content-Type: application/json' -d '{"model":"food-review","prompt":"hi","max_tokens":10,"temperature":0}' | jq
136144
137145
-----------------------------------------
138146
EOF

0 commit comments

Comments
 (0)