Kubernetes Patterns Environment Variable-Based Configuration
Jump to navigation
Jump to search
External
Internal
Overview
Environment variables are universally supported and suited for configuration values that are small in size. Every operating systems allows definition of environment variable, and every programming language allows easy access to these environment variables.
As long as the application is coded to expect configuration as environment variables, the actual values of those environment variables can be provided in different layers:
- Dockerfile
ENV
directive. - As command line override when running the container.
- As hardcoded environment variable values in Kubernetes Pod manifest files with
spec.containers[*].env
, or their corresponding representation in Deployment or ReplicaSet manifest files. - As environment variable values projected into pods by ConfigMaps and Secrets.