← All posts

When the endpoint checks nobody, the network is the only lock

A dark sci-fi corridor lined with faint circuit traces: a translucent magenta energy gate spans the passage in front of an open cyan doorway at the far end, while a second cyan doorway stands open in the right-hand wall beside the gate.

This is my homelab: single-node Kubernetes clusters on Talos with Cilium 1.19 as the network layer, run by one operator. Nothing here describes an employer's systems. The model server and the rules in front of it are my own configuration, the dates come from the commit history and my notes, and each refusal quoted was observed on the date given. Addresses and host names are left out on purpose.

Architecture drawings are full of boxes that check who is calling. Most of them do, and the habit is so settled that a network rule in front of one reads as belt and braces: a second lock on a door that already has one.

The local model server in my lab has no lock at all. Ollama has no built-in authentication, and the version I run answers whoever reaches its port. There is no token to present and no account to hold, and the same port that serves a chat also manages the models on disk.

So the lock was never on the server. It is whatever stands in the corridor in front of it, and in my lab that is a network policy. When the endpoint checks nobody, the rule that decides who may open a socket to it is the login.

The model server checks nobody, so the namespace floor in front of it is the login: the gateway's pods carry the one label it admits, the node itself is the only other caller it lets through, and a LAN host or any other pod is dropped before it reaches the server

Read the rule as the login it is

On 24 June 2026 the server went live on a LoadBalancer address on the home LAN, and I proved it worked by asking it for a completion from my bastion host. That test proved more than I meant it to. The bastion held nothing the server had ever asked for. It had a route, and so did every other device on that network.

By design, consumers never call the model server. They call a gateway in front of it that gives each one a scoped key with a model allowlist and a budget (the switchboard post covers it). Those keys mean something only if nothing can reach the server around the gateway, and the gateway cannot enforce that about itself. The network has to.

Network policy is usually argued as egress control, stopping a compromised workload from calling out. This rule runs the other way. It is the only answer to "who are you?" the server will ever get, so I treat it as auth code: in git, reviewed, and proven by the connection that must fail.

Write the floor, then the one door in it

Two days after go-live, on 26 June, the namespace got its floor and one door. This is the deny floor and the ingress door from the file in my GitOps repo as it stands today (the 8080 line came in August), with the comments written for this page:

apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: default-deny
  namespace: llm-serving
spec:
  endpointSelector: {}
  ingress:
    - fromEndpoints: []          # zero peers: nothing gets in
  egress:
    - toEndpoints: []            # zero peers: nothing gets out
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
  name: allow-ingress
  namespace: llm-serving
spec:
  endpointSelector: {}
  ingress:
    - fromEntities: [host]       # the node itself: kubelet probes, and anything in the host network namespace
    - fromEndpoints:
        - matchLabels:
            app: litellm
            io.kubernetes.pod.namespace: ai-gateway   # the gateway's pods
      toPorts:
        - ports:
            - {port: "11434", protocol: TCP}
            - {port: "8080", protocol: TCP}           # a second runtime, same rule

The floor is written in the zero-peer form because on Cilium 1.19 that is the form that enforces; why a bare ingress: [] passes a server dry-run and then enforces nothing is a story for another post. The door names a pod identity, and that moves the login question somewhere useful: anyone who can deploy a pod labelled app: litellm into the gateway's namespace can walk through it, so the access control on that namespace is part of the server's login too.

The host line is a second door, and a wider one. It carries no port list, so it admits the node and every host-network pod on it, on every port. Whoever can schedule a host-network pod on that node holds a key. The Kubernetes API is a third door, and network policy never sees it: anyone allowed pods/portforward or pods/exec in the server's namespace reaches the port from inside. Those permissions, and the right to run a host-network pod, belong in the same review as the rule file.

The gateway calls the server by its cluster-internal name, so the LAN address from go-live does no work in this design. A ClusterIP Service would remove the LAN path outright, and the second runtime has only ever had one.

The diff on this file is a diff on who may use the models.

Watch a side door get cut

On 5 August my assistant app, which runs on a different cluster, had no models. There were two faults. The server was scaled to zero in git, left over from a June change, and the floor was dropping the app because it called the model server directly instead of going through the gateway.

The pair of requests that told them apart came from inside the app's pod. The model server timed out with no HTTP status at all; the gateway answered 401. A 401 meant the network between the clusters was fine and the floor was doing exactly what it was written to do.

The quick fix was a side door: a fromCIDR rule for the other cluster's node address, plus the service change from the SNAT post so that address survived long enough to be matched. It worked, and it rewrote the login. A single /32 in front of a server that checks keys is an extra lock; in front of one that checks nobody it is the whole lock, and it admits a node, not a caller. Any workload on that cluster whose own rules let it out would leave wearing the same node address, so "the assistant may use the models" had become "that cluster may".

The commit that opened the side door went in after midnight, and the one that closed it carries the same date. The close moved the app onto the gateway with a key of its own, and the side door was gone.

Prove it with the connection that must fail

A rule like this is worth what its refusals are worth, and a refusal on its own proves little: a caller with a broken network gets silence too. The test that means something is a pair from the same caller. The model server must not answer, and something else must. On 26 June I had half of that: a completion through the gateway worked and internet egress was blocked. The full pair came on 5 August, from one pod, the assistant's: the timeout and the 401.

Then confirm the silence belongs to the floor and not to anything else on the path:

kubectl -n kube-system exec ds/cilium -c cilium-agent -- \
  timeout 30 hubble observe --follow --to-namespace llm-serving --verdict DROPPED
# start it, then send the test pair inside the 30 seconds
# a line with "Policy denied" is a caller the floor refused; the gateway must never appear

Start the watch before the test, not after. The agent keeps a short ring buffer, and on my busiest cluster that holds well under a minute of flows, so a read taken afterwards can show nothing for a drop that happened. Read the drop reason as well as the verdict: DROPPED also covers packets refused for reasons that have nothing to do with policy. The timeout runs inside the agent's container, so the watch ends there too instead of outliving the session that started it.

The principle

Put a layer in front of a device that cannot refuse a caller and that layer is not defence in depth; it is the depth. The rule file gets read like a login check, its refusals get tested like a login check, and a change to it is a change to authentication, including the side door cut after midnight to get something working again. The server will never ask who is calling, so the corridor has to.

As of 30 November 2026, in git since 26 June: one label and the node are the only callers this model server's floor admits, and the side door opened on 5 August was shut the same night.

Read next