Cloud Computing Tutorial
- What is Cloud Computing
- Basics of Cloud Computing
- CLOUD COMPUTING
- DEPLOYMENT MODELS
- Utility Computing
- Types of Cloud
- Grid Computing
- Cloud Computing-Architecture
- Private Cloud
- Hybrid Cloud
- Service-Oriented Architecture (SOA)
- Cloud Computing – Virtualization
- Cloud Computing Tenets
- Community Cloud
- Cloud Models
- Data Storage
- Internet and the Web
- IOT (Internet of Things)
- Mobile Cloud Computing
Kubernetes Environment Variables
Kubernetes environment variables provide all advantages that we get in normal environment variables in Linux or any application development.
Kubernetes environment variables are nothing but the variables that we can define in a Pod’s configuration and it can be used elsewhere in the configuration. We can define Kubernetes environment variables using a ConfigMap in Kubernetes to keep configuration artifacts separately and also make containerized application portable. We can use the ‘env’ or ‘envFrom’ field to set Kubernetes environment variables. It overrides any environment variables specified in the container image. We also have dependent environment variables. We can use $(VAR_NAME) in the value of env in a configuration file to set dependent environment variables.
How environment variables work in Kubernetes?
We have to use the ‘env’ keyword in YAML files in which we want to declare environment variable, it might be pod YAML file or secret YAML file, etc. We have then specified the name of the environment variables and their values under the env keyword as shown in the above example. We have to use the ‘printenv’ to list the pod’s container environment variables. It lists all environment variables including variables specified explicitly in the YAML file. We can also reference environment variables from configMap as well.
- It is very useful to specify environment variables to containers while pod creation for example if we want to assign a tag to a container, etc.
- It helps to override the image variables in container if required.
- It also allows us to reference the value from ConfigMap or secrets.