Context
Every webserver pod start copies the whole application source from the image into an emptyDir
(cp -r -n /var/www/html/. /tmp/source-codes) so the nginx sidecar can serve the same files.
Cost: tens of seconds of startup, duplicated disk usage on the node, and the init container
is pure overhead — the code is already in the image.
Proposal (investigation)
Evaluate alternatives to the copy:
- A: multi-stage build that puts the static/public assets into the nginx image — nginx
serves its own copy, php-fpm serves from its image, no shared volume at all
- B: nginx sidecar runs the application image with an nginx binary (single image, no copy)
- C: keep the shared volume but populate it via an image
subPath-style approach /
readOnly bind of the image filesystem (not natively supported — likely rejected)
- D: status quo +
medium: Memory and/or sizeLimit as micro-optimizations
Constraint: must keep the "symlink switch" deploy semantics the app relies on
($realpath_root in the nginx config) — verify with the application team.
Deliverable: decision record; implementation follow-up depends on project-base image changes.
Tasks
Related: #26 (warmup init container)
Context
Every webserver pod start copies the whole application source from the image into an emptyDir
(
cp -r -n /var/www/html/. /tmp/source-codes) so the nginx sidecar can serve the same files.Cost: tens of seconds of startup, duplicated disk usage on the node, and the init container
is pure overhead — the code is already in the image.
Proposal (investigation)
Evaluate alternatives to the copy:
serves its own copy, php-fpm serves from its image, no shared volume at all
subPath-style approach /readOnlybind of the image filesystem (not natively supported — likely rejected)medium: Memoryand/or sizeLimit as micro-optimizationsConstraint: must keep the "symlink switch" deploy semantics the app relies on
(
$realpath_rootin the nginx config) — verify with the application team.Deliverable: decision record; implementation follow-up depends on project-base image changes.
Tasks
Related: #26 (warmup init container)