Closed muhamadazmy closed 6 months ago
From the stackoverflow thread it seems to be OS dependent. /etc/environment
seems to be working with Ubuntu but on Alpine for example it's in /etc/profile
. Do we check what OS we are using or which env file exists and append based on that?
Yeah i know it's os dependent but was hoping that all distros uses the same file.
After looking into it, it turned out there is no standard way or file that guarantee global environment variables for all processes to use. Cloud-init also does not handle environment variables at all. IMO I think the approaches we are doing now with setting it in containers and passing it as kernel args in VMs are enough.
I agree:
container like
VMs where the VM has no kernel and we provide our own injected kernel+initramfs that can pass env vars to init.I will close this as won't fix
To unify passing env vars for cloud-init and cloud container we should pass env vars from the /etc/environment file. By providing a
write-file
option to cloud init as per this post herehttps://stackoverflow.com/questions/38044184/how-to-set-system-wide-environment-variable-in-cloud-config-file-on-digital-ocea