Certified Kubernetes Application Developer (CKAD) Practice Test

Question: 1 / 400

How can environment variables be passed into a container?

By using the -e flag in the kubectl run command.

Through the env or envFrom fields in the pod specifications.

Passing environment variables into a container can be effectively accomplished using the env or envFrom fields in the pod specifications. This method allows you to specify a set of environment variables that will be available to the application running inside the container.

When utilizing the env field, you can provide key-value pairs for each environment variable directly in the pod spec. The envFrom field, on the other hand, allows you to import variables from a ConfigMap or Secret, which is particularly useful for managing sensitive data or configuration settings without hardcoding them into your application.

This approach provides a flexible, declarative way to configure environment variables at runtime, leveraging Kubernetes' native features for configuration management. It separates the application code from configuration, aligning with best practices for cloud-native application development.

While the other options do have relevance in container management and deployment, they do not directly address the primary method of injecting environment variables into running containers in a Kubernetes context.

Get further explanation with Examzify DeepDiveBeta

By defining them directly within the Dockerfile.

By including them in the container image metadata.

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy