The pod failed. The logs were clean. The code was fine. The problem was an environment variable no one remembered setting.
In OpenShift, environment variables are the bloodstream of your deployments. They define how applications talk to services, where they store data, and which secrets stay hidden. When you get them wrong, nothing works. When you get them right, scaling and managing containers becomes simple and predictable.
OpenShift lets you set environment variables at the DeploymentConfig, BuildConfig, or Pod level. You can create them through the web console, the CLI, or directly in YAML. The key is understanding scope. A variable at the Pod template level only lives for that Pod. A variable in a DeploymentConfig is inherited by all future Pods in that deployment. Global consistency demands discipline—keep them defined in version-controlled manifests instead of ad hoc edits in the console.
Secrets and ConfigMaps are the backbone of secure and maintainable environment variables in OpenShift. Instead of hardcoding API keys or database passwords, store them in a Secret, then inject them as environment variables or mount them as files. With ConfigMaps, you can manage non-sensitive configurations the same way. This separation of data from code means updates happen without rebuilding the image.