﻿# Start a local serving proxy before the model container

Gate the next initialization step on meaningful sidecar startup, and avoid a probe that depends on the model waiting behind it.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-ks-sidecar-start-order/
Language: en

A model container immediately connects to a local proxy when it starts. Both run in one Pod, yet the model sometimes exits before the proxy accepts connections. Merely listing two ordinary application containers does not establish the dependency the application expects.

## Use the ordered sidecar lifecycle

Kubernetes-style sidecars are restartable entries in initContainers, using restartPolicy set to Always. They retain ordered initialization behavior while continuing alongside the application. Confirm support on the installed cluster. An ordinary application container with a descriptive sidecar name does not acquire this lifecycle automatically.

## Define what started must mean

Without a startup probe, the sidecar's started state can become true when its process is running. That is weaker than a listening proxy with loaded configuration. A supported startup probe can hold the next initialization step until the proxy meets the chosen startup condition. Probe the local dependency the model actually needs.

## Keep readiness a different decision

A sidecar readiness probe can influence Pod readiness, but readiness is not the same startup-order boundary. Do not assume that making the Pod unready prevents the main process from starting and attempting its first connection. The startup probe and application retry logic need to cover that initialization race deliberately.

## Avoid a circular dependency

The proxy's startup check must not require the model to be running if the model itself waits for the proxy. Use a condition demonstrating proxy initialization independently of backend readiness. Otherwise the ordered configuration creates a deadlock. The proxy can start successfully while the complete Pod remains unready until the model finishes loading.

## Test the delayed-proxy case

In an isolated fixture, delay proxy initialization and observe when the model process begins. Then fail the proxy's startup check and verify that behavior follows the intended lifecycle. Finally confirm the model's bounded reconnect handling after a later proxy restart. Startup ordering solves the initial dependency; it does not promise that the supporting process can never fail during service or that every upstream connection is healthy.

## Primary references

[Kubernetes Sidecar Containers](https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/).

[Configure Liveness, Readiness and Startup Probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/).

[Kubernetes Pod Lifecycle](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/).

Related reading: [Pod restarts while loading: configuring a startup probe](/journal/kubernetes-startup-probe-restart-loop/); [Startup, readiness and liveness for a slow-loading model server](/journal/provider-startup-readiness-liveness-separation/).
