Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Setup the Istio service to be a NodePort service and not a ClusterIP service #38

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions deploy/environments/dev/kind/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: inference-gateway
annotations:
networking.istio.io/service-type: NodePort
4 changes: 4 additions & 0 deletions deploy/environments/dev/kind/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- services.yaml
- ../../../components/istio-control-plane/
- ../../../components/vllm-sim/
- ../../../components/inference-gateway/

patches:
- path: gateway.yaml
28 changes: 28 additions & 0 deletions deploy/environments/dev/kind/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v1
kind: Service
metadata:
annotations:
networking.istio.io/service-type: NodePort
labels:
gateway.istio.io/managed: istio.io-gateway-controller
gateway.networking.k8s.io/gateway-name: inference-gateway
istio.io/enable-inference-extproc: "true"
name: inference-gateway-istio
namespace: default
spec:
type: NodePort
selector:
gateway.networking.k8s.io/gateway-name: inference-gateway
ports:
- appProtocol: tcp
name: status-port
port: 15021
protocol: TCP
targetPort: 15021
nodePort: 32021
- appProtocol: http
name: default
port: 80
protocol: TCP
targetPort: 80
nodePort: 30080
20 changes: 14 additions & 6 deletions scripts/kind-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Set the namespace to deploy the Gateway stack to
: "${PROJECT_NAMESPACE:=default}"

# Set the host port to map to the Gateway's inbound port (30080)
: "${GATEWAY_HOST_PORT:=30080}"

# ------------------------------------------------------------------------------
# Setup & Requirement Checks
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -63,7 +66,16 @@ done
if kind get clusters 2>/dev/null | grep -q "^${CLUSTER_NAME}$"; then
echo "Cluster '${CLUSTER_NAME}' already exists, re-using"
else
kind create cluster --name "${CLUSTER_NAME}"
kind create cluster --name "${CLUSTER_NAME}" --config - << EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30080
hostPort: ${GATEWAY_HOST_PORT}
protocol: TCP
EOF
fi

# Set the kubectl context to the kind cluster
Expand Down Expand Up @@ -126,13 +138,9 @@ You can watch the Endpoint Picker logs with:

$ kubectl --context ${KUBE_CONTEXT} logs -f deployments/endpoint-picker

You can use a port-forward to access the Gateway:

$ kubectl --context ${KUBE_CONTEXT} port-forward service/inference-gateway-istio 8080:80

With that running in the background, you can make requests:

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

-----------------------------------------
EOF