﻿# Resolve a named targetPort across model revisions

Resolve the target name for each Pod and inspect all EndpointSlices before treating mixed backend ports as a rollout fault.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-ks-named-targetport-revisions/
Language: en

A rolling model update changes the application's listening port while keeping the Service stable. A named targetPort can resolve to different numeric ports on old and new Pods. This supports mixed revisions during rollout, but it requires the same intended port name to be declared correctly and the process to listen where the Pod advertises.

## Distinguish the three names

Read the Service port's name, its targetPort and each selected Pod's container-port declarations. They serve related but different purposes. A named targetPort refers to a named port on the backend Pod; the Service's own port name does not automatically create that declaration. Preserve protocol alongside the name when comparing revisions and avoid inferring a backend from a familiar Service port.

## Resolve per backend

The controller can resolve the same target name to different numeric ports on different Pods. Therefore an old revision and a new revision need not share a fixed backend number. Inspect each Pod's effective template and revision identity. A global search for one numeric port misses the mechanism and can incorrectly label a valid mixed rollout as inconsistent.

## Read every relevant slice

EndpointSlices group endpoints with compatible port information. Multiple port numbers can therefore appear across slices for one Service. Follow the Service association and inspect endpoint address, resolved port, readiness and target Pod together. Reading the first slice alone is not an inventory of every backend, particularly during a rolling transition.

## Verify the actual listener

A containerPort declaration does not open a socket or configure the model server. Compare application startup configuration and an authorized listener observation with the resolved target. A correct name pointing at an unused port still fails traffic. Do not repair a listener mismatch by broadening a Service selector to unrelated healthy Pods; that changes the backend population.

## Test a mixed revision fixture

Use harmless old and new backends with different numeric listeners and the intended shared target name. Confirm that both resolve correctly, then include a deliberate missing-name or wrong-listener case. Success establishes routing for that port contract. It does not validate response compatibility, model identity, stream draining or rollout safety merely because both revisions can accept a connection.

## Primary references

[Kubernetes Service](https://kubernetes.io/docs/concepts/services-networking/service/).

[Kubernetes EndpointSlices](https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/).

[Pod API](https://kubernetes.io/docs/reference/kubernetes-api/core/pod-v1/).

Related reading: [Updating an LLM on a GPU: testing a new version with a small rollout](/journal/model-update-canary/); [Pod is Terminating but still receives traffic: checking EndpointSlices](/journal/kubernetes-terminating-endpoints/).
