Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A mounted Kubernetes Secret can update in a running Pod, but not immediately—and not in every mount configuration. A normal Secret volume is updated eventually as the kubelet reconciles Pod state. A Secret mounted using subPath does not receive automated updates. Even when a file changes, the application may keep using an old value until it reloads it.

First check whether the mount uses subPath

Inspect the Pod specification’s volumeMounts. A Secret mounted as a regular directory volume is eligible for automatic, eventual projection updates. If the mount specifies subPath, Kubernetes does not automatically update that mounted file or directory when the Secret changes. See the Kubernetes documentation on Secrets and Volumes.

If the application needs refreshed files, mount the Secret volume directory rather than an individual file through subPath, and have the application read the key from its projected path. If changing the mount is not practical, replace the Pod when the Secret changes.

For a normal volume, allow for eventual projection

Changing a Secret object does not synchronously rewrite every mounted file. The kubelet detects changes to Secrets used by Pods on its node and projects updated data during reconciliation. Kubernetes describes the delay as potentially lasting up to the kubelet sync period plus cache propagation delay.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The kubelet can detect Secret changes through an API watch (the documented default), a TTL-based cache, or direct API polling during kubelet sync. The cache contribution therefore depends on the cluster’s configured strategy. There is no universal timing guarantee, and Kubernetes does not promise that all Pods or nodes receive the update simultaneously. The kubelet sync loop periodically reconciles desired Pod state with running containers.

Changing the change-detection strategy is not automatically an end-to-end latency fix. Review the kubelet configuration and measure behavior in the affected cluster before drawing that conclusion.

Check whether the file changed or only the Secret object

  1. Confirm that the Secret object contains the intended value.
  2. Check the Pod’s volume mount configuration and confirm it is not using subPath.
  3. After allowing time for kubelet reconciliation and cache propagation, inspect the projected file from inside the container.
  4. If the file has the new value, determine whether the application has reloaded it or is still using a value cached in memory.

If the projected file is current but the service still authenticates with the old credential, Kubernetes projection is no longer the likely issue. The application may read the file only at startup, retain the value in memory, or fail to reopen the file. File delivery and application reload are separate behaviors; the latter depends on the application.

Environment variables do not refresh in a running container

A Secret exposed as an environment variable is provided when the container starts. Updating the Secret object does not mutate the environment of an already-running process. To make the process receive the new value, replace the container through a rollout or another restart mechanism. For mounted files, seamless rotation likewise requires the application to watch for changes or periodically reopen the file. Kubernetes explains the Secret delivery options in its Secrets documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the fix that matches the delivery method

Delivery method Can a running Pod receive changed data? What must happen for the application to use it? Timing and operational control
Regular Secret volume Yes, eventually, through kubelet projection. The application must reload or reread the projected file if it otherwise retains the old value. Depends on kubelet sync and cache propagation; no universal simultaneous-update guarantee.
Secret volume mounted with subPath No automated Secret update reaches this mount. Change the mount design or replace the Pod. Automatic refresh is not provided for this mount.
Secret as an environment variable No; the existing process environment is unchanged. Replace the container or Pod so a new process starts with the current value. Refresh occurs through the replacement process, not live environment mutation.
External store through Secrets Store CSI Driver Depends on the driver and provider’s rotation behavior. The application may still need to reload or reread delivered files. Provider-specific; Kubernetes guidance does not establish one refresh schedule for every provider.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When an external secret store is relevant

If the source of truth is an external secret manager, Kubernetes documents the Secrets Store CSI Driver as an integration option. It is an architectural choice, not a universal cure for stale values: provider-specific rotation behavior determines delivery, and an application that caches credentials may still need to reload them.

Secret volumes are read-only and backed by tmpfs on the node. Kubernetes security guidance also recommends granting access only to the containers that need a Secret. These controls address handling and access, not refresh timing.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.