CKA YAML Configuration 3 — Questions and Answers
Question 1: In a Kubernetes StatefulSet YAML, which field under `volumeClaimTemplates` defines the storage size requested per pod?
- storage.size
- resources.requests.storage (Correct answer)
- capacity.storage
- spec.volumeSize
Correct answer: resources.requests.storage
The `resources.requests.storage` field inside `volumeClaimTemplates[].spec` specifies how much storage each StatefulSet pod requests.
Question 2: Which YAML structure correctly defines a Kubernetes Service that exposes port 80 externally and targets port 8080 on pods?
- ports: [{port: 80, nodePort: 8080}]
- ports: [{port: 80, targetPort: 8080}] (Correct answer)
- ports: [{externalPort: 80, containerPort: 8080}]
- ports: [{exposed: 80, internal: 8080}]
Correct answer: ports: [{port: 80, targetPort: 8080}]
A Service spec uses `port` for the Service's exposed port and `targetPort` for the container port it forwards traffic to.
Question 3: What does the `imagePullPolicy: Never` field in a container spec instruct Kubernetes to do?
- Always pull the image from the registry before starting the container
- Pull the image only if it is not already present on the node
- Never pull the image; use only locally cached images (Correct answer)
- Pull the image once and cache it permanently
Correct answer: Never pull the image; use only locally cached images
`imagePullPolicy: Never` tells the kubelet to never pull from a registry, failing if the image is not already present locally on the node.
Question 4: In a Kubernetes YAML, which field in a container spec maps a host path to a container path?
- hostMount
- volumeMounts[].mountPath paired with a volumes[] hostPath entry (Correct answer)
- bind: {host: ..., container: ...}
- mounts[].hostPath
Correct answer: volumeMounts[].mountPath paired with a volumes[] hostPath entry
A `hostPath` volume is declared in `spec.volumes[]` and mounted into a container via `spec.containers[].volumeMounts[]` with a `mountPath`.
Question 5: What is the purpose of the `terminationMessagePath` field in a Kubernetes container spec?
- Path to the container's main log file
- Path where the container writes its termination reason message (Correct answer)
- Path to the container's readiness probe output
- Path to the container's crash dump file
Correct answer: Path where the container writes its termination reason message
Kubernetes reads `terminationMessagePath` (default `/dev/termination-log`) to surface the container's exit reason in Pod status.
Question 6: Which YAML field on a PersistentVolumeClaim defines the storage class to use?
- spec.storageClass
- spec.storageClassName (Correct answer)
- spec.class
- metadata.storageClass
Correct answer: spec.storageClassName
The `spec.storageClassName` field on a PVC references a StorageClass object that determines the provisioner and volume parameters.
Question 7: In a Kubernetes CronJob YAML, which field controls the maximum number of successfully completed Jobs to retain?
- spec.completionLimit
- spec.successfulJobsHistoryLimit (Correct answer)
- spec.jobRetentionCount
- spec.maxCompletedJobs
Correct answer: spec.successfulJobsHistoryLimit
`spec.successfulJobsHistoryLimit` (default 3) controls how many completed Job objects are kept for a CronJob.
In a Kubernetes StatefulSet YAML, which field under `volumeClaimTemplates` defines the storage size requested per pod?