Purpose of ConfigMaps
What is the main purpose of a ConfigMap in Kubernetes?
- To store non-confidential configuration data as key-value pairs
- To scale deployments automatically based on load
- To manage container images in a registry
- To encrypt secret data in transit
- To provide persistent storage for Pods
Mounting ConfigMap as a Volume
Which field in a PodSpec is used to mount a ConfigMap as a volume inside a container?
- volumes
- envVars
- containersConfig
- volumeMounts
- mountVolumes
Secrets Storage
Where are Kubernetes Secrets stored by default?
- Etcd database
- Docker registry
- Pod annotations
- Kubelet logs
- ConfigMap
Correct way to create a ConfigMap
Which command correctly creates a ConfigMap named 'app-config' from a file named config.properties?
- kubectl create configmap app-config --from-file=config.properties
- kubectl add configmap app-config config.properties
- kubectl configmap create app-config config.properties
- kubectl set configmap app-config --file=config.properties
- kubectl config add app-config -f config.properties
Using Secrets as Env Vars
How can you inject a value from a Secret as an environment variable in a Kubernetes Pod?
- Using the envFrom field in the Pod spec
- By mounting the secret as a command line arg
- By specifying it in the volumes field
- By referencing it in the labels section
- By setting it in the readinessProbe
Data Decoding for Secrets
What encoding must values use in a Kubernetes Secret manifest YAML?
- Base64
- Hexadecimal
- UTF-16
- Plain text
- ROT13
ConfigMap vs Secret
Which resource should you choose in Kubernetes for storing sensitive database passwords?
- Secret
- ConfigMap
- PersistentVolumeClaim
- Deployment
- ServiceAccount
Updating ConfigMap Data
If you update the data in a ConfigMap, how do existing Pods using it usually receive the updated data?
- They need to be restarted to pick up changes
- ConfigMap changes are pushed instantly to running Pods
- ConfigMap data is cached and never updates
- The API server automatically rewrites the Pod
- kubectl apply forces a live update to all pods
Accessing Secret in Pod as File
If you want a Pod to read credentials from a file, which method should you use?
- Mount the Secret as a volume
- Add the Secret to container’s command args
- Set Secret as environment variables
- Reference Secret in Service spec
- Include Secret in the readinessProbe
Referencing a ConfigMap Key
Given this YAML, how do you reference the key 'USERNAME' from ConfigMap 'user-conf' in a Pod's container env? nn env:n - name: APP_USERn valueFrom:n configMapKeyRef:n __________:n name: user-confn key: USERNAME
- configMapKeyRef
- valueFrom
- reference
- configValue
- mapKey