﻿# Stop unneeded API credentials entering a model container

Pod automount settings override ServiceAccount settings; verify actual mounts and review explicit credentials separately.

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

A model container only reads local weights and serves its own API, yet it receives Kubernetes API credentials automatically. Disabling credential automount can remove that unnecessary local token path. Check the effective Pod setting and explicit projections instead of assuming a ServiceAccount-level change controls every workload.

## Establish the workload's API need

List actual operations requiring Kubernetes identity, including sidecars that watch objects. A model server may not need API access while a colocated controller does. Make the dependency explicit before changing credential delivery. A process that genuinely needs a token should use a supported, scoped authentication design rather than an accidental shared default.

## Read precedence correctly

automountServiceAccountToken can be set on the ServiceAccount or on the Pod. When both specify a value, the Pod setting takes precedence. Inspect the admitted Pod and workload template, including mutation by admission. Editing the ServiceAccount alone does not prove that an existing or newly generated Pod has the intended effective setting.

## Inspect explicit credentials too

Opting out of automatic mounting does not erase a manually declared token projection, another Secret mount or an external API key in the application. Inventory the actual credential sources separately. The intended claim is removal of the automatic path, not proof that the container possesses no credentials of any kind.

## Keep authorization independent

RBAC grants determine what an authenticated identity may do. Removing a mounted token does not itself delete those grants, and a narrow role does not mean the token needs to be mounted into every model container. Review identity permissions and credential delivery as distinct controls with distinct evidence.

## Verify absence and continued service

In an isolated fixture, inspect mounts and test that the expected automatic token path is absent without dumping environment or Secret values. Run the model's bounded normal API check and verify any required sidecar dependency. Acceptance means unnecessary automatic credentials are absent and intended functions still work. It does not establish network isolation or revoke credentials already copied elsewhere; those properties require their own explicit configuration and lifecycle handling.

## Primary references

[Configure Service Accounts for Pods](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/).

[Kubernetes Service Accounts](https://kubernetes.io/docs/concepts/security/service-accounts/).

[Kubernetes RBAC Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/).

Related reading: [ServiceAccount token expired: audiences and projected token rotation](/journal/kubernetes-projected-serviceaccount-token/); [Equipment security when joining a GPU pool](/journal/hardware-security/).
