Repository navigation
Description
Summary
The Gateway controller applies spec.server.port to the container port, both probes, the Service and the HTTPRoute backend, and spec.telemetry.metrics.port to the metrics container and Service port, but it never tells the gateway process about either value: no SERVER_PORT or TELEMETRY_METRICS_PORT env var is emitted anywhere in internal/ (internal/controller/gateway_controller.go L480-483 and L723-742 for the probes, L527-540 for the base env, L864-899 for the Service, L1553-1591 for the container ports). The gateway reads both from env with defaults 8080 and 9464 (ServerConfig.Port and TelemetryConfig.MetricsPort in inference-gateway/inference-gateway config/config.go), so any non-default value leaves the process listening on the default port while Kubernetes probes and routes traffic to the configured one. The README presents both as working settings (telemetry.metrics.port in the Quick Start and Minimal Gateway examples, "1024-65535 for server ports" under Configuration Validation, and the Port print column on kubectl get gateway). spec.server.tls has the same gap: the controller mounts a hardcoded Secret inference-gateway-tls at /app/tls (L377-391), ignores certificateRef / keyRef, and never sets SERVER_TLS_CERT_PATH / SERVER_TLS_KEY_PATH.
Steps to Reproduce
- In a namespace labeled
inference-gateway.com/managed=true, apply a Gateway with one provider plusspec.server.port: 9000andspec.telemetry: {enabled: true, metrics: {enabled: true, port: 9465}}. - Inspect the generated Deployment:
kubectl get deploy <name> -o jsonpath='{.spec.template.spec.containers[0]}'. Container ports are9000and9465and both probes target9000, but the env contains onlyENVIRONMENT,TELEMETRY_ENABLED,AUTH_ENABLEDand the provider vars. - Watch the pod (
kubectl get pod -l app=<name> -w) and, from inside the cluster, runcurl http://<name>:9465/metrics.
The same Deployment and Service shape was reproduced offline by calling GatewayReconciler.Reconcile against a controller-runtime fake client.
Expected Behavior
The controller emits SERVER_PORT from spec.server.port and TELEMETRY_METRICS_PORT from spec.telemetry.metrics.port (and the TLS path vars when spec.server.tls.enabled), so the gateway listens where the probes, Service and HTTPRoute point.
Actual Behavior
The gateway always listens on 8080 and serves metrics on 9464. With server.port: 9000 the liveness and readiness probes on 9000 fail, so the pod never becomes Ready and is restarted repeatedly. With metrics.port: 9465 the Service's metrics port targets a closed port and scraping fails.
Activity
edenreich commentedon Oct 4, 2026
@claude can you work on this? use /ponytail:ponytail
inference-gateway-maintainer commentedon Oct 4, 2026
Claude finished @edenreich's task in 7m 39s —— View job •
fix/issue-271-20261004-1100• [Create PR ➔](https://github.com/inference-gateway/operator/compare/main...fix/issue-271-20261004-1100?quick_pull=1&title=Issue%20%23271%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23271%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)Done
inference-gatewayconfig/config.go)SERVER_HOST/SERVER_PORT/TELEMETRY_METRICS_PORT/SERVER_TLS_CERT_PATH/SERVER_TLS_KEY_PATHspec.server.tls.certificateRef/keyRefinstead of the hardcoded SecretWhat changed
internal/controller/gateway_controller.go:buildContainernow emitsSERVER_PORT(fromspec.server.port, default8080) andSERVER_HOST(fromspec.server.host, default0.0.0.0- the gateway's own default is loopback, unreachable from kubelet probes), plusTELEMETRY_METRICS_PORTwhen telemetry and metrics are enabled.certificateRef/keyRefare each mounted from their own Secret (/app/tls/cert/<key>,/app/tls/key/<key>) andSERVER_TLS_CERT_PATH/SERVER_TLS_KEY_PATHpoint at them. With no refs set, behaviour is unchanged - the conventionalinference-gateway-tlsSecret at/app/tls.gatewayServerPort,gatewayMetricsPort,metricsEnabled,serverTLSEnabled). That surfaced a second bug -buildContainerPortsreturned early whenspec.serverwas nil, so a Gateway with metrics enabled but no server block got nometricscontainer port while the Service exposed one. Fixed.No CRD/API change, so no regenerated manifests.
task test(176 specs),task fmt,task vet,task lintall clean.Skipped: the hardcoded
8443https container/Service port - not part of this issue, andspec.server.tlshas no port field to drive it. Worth a separate ticket if you want it configurable.Docs follow-up filed: inference-gateway/docs#962.
PR
#279
| Branch
inference-gateway-releaser commentedon Oct 4, 2026
🎉 This issue has been resolved in version 0.27.1 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀