✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Kubernetes Package Environment Customization

Kubernetes Package Environment Customization allows tailored runtime configurations for containerized applications within Kubernetes clusters.

Kubernetes Package Environment Customization is the tool-agnostic practice of deciding which categories of configuration genuinely differ between deployment environments, development, staging, production, and structuring a package, regardless of whether it uses Helm, Kustomize, or another mechanism, so that those differences are expressed cleanly without compromising the parity that keeps environments comparable to each other.


Categories of Legitimate Environment Difference

Scale and Resource Allocation

# production
replicas: 5
resources:
  requests: { cpu: 500m, memory: 1Gi }
# development
replicas: 1
resources:
  requests: { cpu: 100m, memory: 128Mi }

Replica counts and resource requests/limits are among the most universally legitimate environment differences, since a development environment reasonably runs a single, minimally resourced replica while production runs enough replicas and capacity to serve real traffic and tolerate node failure.

External Dependency Endpoints

databaseHost: dev-db.internal.example.com
databaseHost: prod-db-primary.internal.example.com

Endpoint addresses for databases, message queues, and third-party services necessarily differ by environment, since each environment typically runs against isolated infrastructure to prevent a development mistake from affecting production data or traffic.

Feature Flags and Rollout Gates

features:
  newCheckoutFlow: true
features:
  newCheckoutFlow: false

Feature flags let a capability be exercised in staging or a canary environment before being enabled in production, a deliberate, temporary environment difference expected to converge once the feature is fully validated and rolled out everywhere.

Legitimate Difference { Scale, Endpoints, Flags, Observability }

Observability Verbosity

Logging and Tracing Sample Rates

logging:
  level: debug
tracing:
  sampleRate: 1.0
logging:
  level: info
tracing:
  sampleRate: 0.05

Development and staging environments commonly run with maximal log verbosity and full trace sampling to aid debugging, while production tunes these down to control cost and log volume at scale, an environment difference that affects observability behavior without changing the application's actual functional behavior.


Domain Names, TLS, and Ingress

Environment-Specific External Identity

ingress:
  host: staging.myapp.example.com
  tls:
    issuer: letsencrypt-staging
ingress:
  host: myapp.example.com
  tls:
    issuer: letsencrypt-production

Hostnames and certificate issuers necessarily differ per environment, and using a staging-specific certificate issuer (rather than a production-grade one) for non-production environments is standard practice to avoid consuming production-tier certificate issuance rate limits during routine testing.


Environment Parity Principles

What Should Not Differ

Following the twelve-factor application principle of dev/prod parity, the application's actual code, its container image build process, and its core structural configuration (container names, port numbers, volume mount paths) should remain identical across every environment; only the categories of difference enumerated above, scale, endpoints, flags, observability tuning, and environment-specific identity, are appropriate targets for customization.

Parity = Same Image Same Structure Different Config

The Risk of Environment-Specific Structural Divergence

A structural difference between environments, staging running a fundamentally different container image build, a different volume mount layout, or different application code entirely, defeats the purpose of testing in a lower environment before production, since a successful staging deployment then provides no real confidence about how production will behave; this is the core justification for keeping only configuration, not structure, environment-specific.


Promotion as a Configuration-Only Operation

The Same Artifact Flows Through Every Environment

kustomize build overlays/staging | grep image:
# image: registry.example.com/myapp@sha256:e3b0c4...
kustomize build overlays/production | grep image:
# image: registry.example.com/myapp@sha256:e3b0c4...

A disciplined promotion process moves an identical, already-tested container image digest from staging to production, changing only the surrounding environment-specific configuration, rather than rebuilding the application separately for each environment, which is the practice that makes "this passed staging" a meaningful predictor of "this will work in production."


Relationship to the Packaging Model and Tool-Specific Areas

Environment customization is the conceptual layer that every specific packaging mechanism, Helm's values files, Kustomize's overlays, ultimately exists to implement, and the categories of legitimate difference described here are what should determine the contents of any environment-specific values file or overlay patch discussed under those tool-specific areas: understanding what should differ between environments, independent of which templating or patching tool is used, is the judgment call that precedes and informs every mechanical customization decision covered elsewhere in this knowledge area.

Same image staging config dev config prod config