Skip to content

[BUG] Gateway with spec.server.tls never becomes Ready: probes stay HTTP on the TLS port #310

Closed

Description

@edenreich

Summary

A Gateway with spec.server.tls.enabled never becomes Ready. The controller keeps the liveness and readiness probes at scheme: HTTP on the server port, but the gateway then serves TLS on that port (ListenAndServeTLS on SERVER_PORT). Every probe gets HTTP 400 and the liveness probe restarts the container. The controller also adds a hard-coded 8443 container port named https, which duplicates the http port when spec.server.port is 8443 and points at nothing otherwise.

Found while moving inference-gateway/cli's examples/kubernetes-session-teleport-netbird (inference-gateway/cli#1671) to TLS on the gateway hop.

Steps to Reproduce

  1. Install operator v0.30.0 and issue a certificate into a Secret gateway-tls (for example with cert-manager).

  2. Apply a Gateway (image ghcr.io/inference-gateway/inference-gateway:0.60.1) with:

    spec:
      server:
        port: 8443
        tls:
          enabled: true
          certificateRef:
            name: gateway-tls
            key: tls.crt
          keyRef:
            name: gateway-tls
            key: tls.key
  3. Inspect the Deployment and the pod: kubectl get deploy gateway -o jsonpath='{.spec.template.spec.containers[0].readinessProbe.httpGet}' and kubectl get events --field-selector reason=Unhealthy.

Expected Behavior

  • The probes use scheme: HTTPS whenever spec.server.tls.enabled is set, and the pod becomes Ready.
  • The container declares one port, spec.server.port, named https when TLS is on.

Actual Behavior

  • readinessProbe.httpGet is {"path":"/health","port":8443,"scheme":"HTTP"}. The kubelet reports Liveness probe failed: HTTP probe failed with statuscode: 400 and restarts the container, so the pod sits at 1/2 with restarts and the old ReplicaSet never scales down.
  • The container ports are [{"containerPort":8443,"name":"http"},{"containerPort":8443,"name":"https"}]. With the default port 8080, https 8443 is declared while the gateway serves TLS on 8080.

Activity

  1. added
    bug
    on Oct 31, 2026
  2. added theissue type on Oct 31, 2026
  3. moved this to Todo in 2026on Oct 31, 2026
  4. edenreich commented on Nov 1, 2026

    @edenreich
    ContributorAuthor

    @claude can you work on this? use /ponytail:ponytail /go /go-concurrency

  5. inference-gateway-maintainer commented on Nov 1, 2026

    @inference-gateway-maintainer
    Contributor

    Claude finished @edenreich's task in 6m 52s —— View job • fix/issue-310-20261101-1240 • [Create PR ➔](https://github.com/inference-gateway/operator/compare/main...fix/issue-310-20261101-1240?quick_pull=1&title=Issue%20%23310%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23310%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Fixed: TLS probes and the phantom 8443 ports

    • Read internal/controller/gateway_controller.go (probes, container ports, Service ports)
    • Probes: scheme: HTTPS when spec.server.tls.enabled
    • Container ports: one port at spec.server.port, named https under TLS
    • Service: dropped the hard-coded 8443 port, named the main port after the scheme
    • gatewayServicePort: no more 8443 fallback (TLS with no explicit port serves on 8080)
    • Tests (3 new specs)
    • task fmt / vet / lint / test - 237 specs pass, 0 lint issues
    • Commit + PR #312

    All four symptoms came from the same hard-coded 8443 assumption in three spots, so the fix is one helper plus three deletions:

    • New healthProbe(gateway) builds both probes and sets Scheme: HTTPS when TLS is on. The two probes were identical literals, so the duplication goes away with it.
    • buildContainerPorts no longer appends 8443/https. One port, spec.server.port, named via a new serverPortName helper.
    • desiredService drops the phantom 8443 port, names the main port after the scheme, and targets the container port by name - which also fixes a latent bug where a spec.service.port differing from spec.server.port targeted its own number instead of the container port.
    • gatewayServicePort no longer returns 8443 when TLS is on without an explicit port: the gateway serves TLS on the default 8080 there, so the Service and status.url now match reality.

    Worth knowing: under TLS the Service port name changes http -> https. Nothing in this repo selects it by name (the HTTPRoute backendRef uses the number), but anything of yours that does needs updating. Docs ticket filed as inference-gateway/docs#1061.

    Not done / not checked: no e2e run against a real cluster with a cert-manager Secret, so the "pod actually goes Ready with ghcr.io/inference-gateway/inference-gateway:0.60.1" leg is unverified - envtest cannot run probes. I also did not add a caBundle/self-signed-cert path for the probe: the kubelet's HTTPS prober skips certificate verification, so a self-signed cert is fine, but that is a property of the kubelet, not something this PR enforces.
    | branch fix/issue-310-20261101-1240

  6. moved this from Todo to In progress in 2026on Nov 1, 2026
  7. moved this from In progress to QA in 2026on Nov 1, 2026
  8. moved this from QA to Done in 2026on Nov 1, 2026
  9. inference-gateway-releaser commented on Nov 1, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.31.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions