Only the api_url key from ConfigMap city-portal should become the PORTAL_URL environment variable. Which configuration is appropriate?
Select an answer to reveal the explanation.
Short Explanation
When one setting needs a new name in the process environment, configMapKeyRef is the adapter cable. Point PORTAL_URL at city-portal’s api_url key. envFrom would pour every key in under their original names.
Full Explanation
When only the api_url key from ConfigMap city-portal should become the PORTAL_URL environment variable, configure an env entry named PORTAL_URL with valueFrom.configMapKeyRef naming city-portal and key api_url. That maps a single ConfigMap key to a deliberately renamed variable—the precise pattern for civic portal apps that expect a stable environment name different from the raw key.
envFrom.configMapRef alone does not rename keys to uppercase PORTAL_URL automatically; it injects keys essentially as stored. A secretKeyRef to city-portal/api_url fails because single-key mapping does not require Secrets and secretKeyRef targets Secret objects. downwardAPI fieldRef to metadata.annotations['api_url'] reads Pod metadata annotations rather than ConfigMap data and is the wrong source for this setting.
Exam caveat: the optional flag changes whether a missing key fails Pod startup; by default a missing referenced key can block the container. Operational check: set the env valueFrom.configMapKeyRef block, roll the Deployment, exec and echo PORTAL_URL, and confirm it matches the ConfigMap api_url value. In CKAD scenarios involving q196, prefer verifying the live object with kubectl get and describe before changing cluster-wide settings.