CKAD Domain 4: Application Environment, Configuration, and Security
48 free practice questions for Application Environment, Configuration, and Security in the Certified Kubernetes Application Developer (CKAD) exam. Try each question first, then open "Show answer" for the correct option and explanation.
Application Environment, Configuration, and Security practice questions
-
Question 1. After installing a CRD named backups.example.com, how do you list the Backup objects in the current namespace?
Show answer
Answer: B. kubectl get backups
A CRD adds a new resource type to the API, so you use kubectl get, describe, and delete with its plural name, short name, or kind.
-
Question 2. What does scope: Namespaced mean in a CustomResourceDefinition?
Show answer
Answer: C. Each custom resource object lives in a namespace
The CRD itself is cluster-scoped. Namespaced means its objects belong to namespaces, like Pods; Cluster means they don't, like Nodes.
-
Question 3. A custom resource is created, but no controller or operator watches its type. What happens?
Show answer
Answer: D. It's stored, but nothing acts on it
The API server validates and stores it in etcd. An operator's controller is what turns custom resources into real actions.
-
Question 4. Which command lists the CustomResourceDefinitions installed in a cluster?
Show answer
Answer: A. kubectl get crd
kubectl get crd (customresourcedefinitions) lists them. kubectl api-resources shows the resource types they add.
-
Question 5. What does a CRD's openAPIV3Schema define?
Show answer
Answer: B. The fields and types a custom resource can contain
The structural schema is used for validation, pruning unknown fields, defaulting, and kubectl explain.
-
Question 6. In what order does the API server process a request?
Show answer
Answer: D. Authentication, authorization, then admission
It first identifies the caller, then checks permissions (for example RBAC), then runs admission controllers that can modify or reject the object.
-
Question 7. Which command checks whether ServiceAccount builder in namespace ci may create Pods there?
Show answer
Answer: C. kubectl auth can-i create pods -n ci --as=system:serviceaccount:ci:builder
ServiceAccounts are impersonated as system:serviceaccount:<namespace>:<name>. The answer is yes or no.
-
Question 8. In the admission phase, in which order do mutating and validating checks run?
Show answer
Answer: A. Mutating first, then validating
Mutation happens first so that validation sees the final object, including any defaults or injected sidecars.
-
Question 9. Which namespace label makes Pod Security Admission reject Pods that break the restricted standard?
Show answer
Answer: B. pod-security.kubernetes.io/enforce: restricted
enforce rejects violating Pods. warn only shows a warning to the user and audit only records an audit annotation.
-
Question 10. Which Pod Security Standards level blocks known privilege escalations but allows most default Pod specs?
Show answer
Answer: C. baseline
baseline blocks things like privileged containers and host namespaces. restricted also requires non-root, dropped capabilities, and a seccomp profile.
-
Question 11. How should a ServiceAccount be allowed to read Secrets in its own namespace only?
Show answer
Answer: B. A Role with get on secrets, bound by a RoleBinding
A Role and RoleBinding are namespaced, so the permission doesn't extend to other namespaces.
-
Question 12. What does a ValidatingAdmissionPolicy let you write without running a webhook server?
Show answer
Answer: D. Validation rules as CEL expressions
ValidatingAdmissionPolicy evaluates CEL expressions inside the API server, with a ValidatingAdmissionPolicyBinding choosing where it applies.
-
Question 13. A container requests cpu: 250m. How much CPU is that?
Show answer
Answer: B. A quarter of one CPU core
m means millicores: 1000m is one CPU (one core or vCPU), so 250m is 0.25.
-
Question 14. What is the difference between 128Mi and 128M of memory?
Show answer
Answer: A. Mi is 2^20 bytes; M is 10^6 bytes
Mi, Gi, and Ki are binary units; M, G, and K are decimal. 128Mi is about 134 million bytes.
-
Question 15. A container reaches its CPU limit. What happens?
Show answer
Answer: C. It is throttled, but not killed
CPU is compressible, so the container gets less CPU time. Exceeding a memory limit is what gets a container killed.
-
Question 16. Every container in a Pod sets requests equal to limits for both CPU and memory. What QoS class does the Pod get?
Show answer
Answer: D. Guaranteed
Guaranteed Pods are the last to be evicted under node pressure. Requests below limits make the Pod Burstable.
-
Question 17. No container in a Pod sets any requests or limits. What QoS class does it get?
Show answer
Answer: A. BestEffort, evicted first under node pressure
BestEffort Pods use whatever is free, and the kubelet evicts them first when the node runs short of memory or disk.
-
Question 18. Namespace dev has a ResourceQuota on requests.cpu. A Pod with no CPU request is created there. What happens?
Show answer
Answer: B. It's rejected unless a LimitRange sets a default
With a quota on a compute resource, every new Pod must specify it. A LimitRange default request fills it in automatically.
-
Question 19. Which LimitRange field rejects containers whose limit is above a given value?
Show answer
Answer: C. max
max caps limits and min sets a floor. default and defaultRequest fill in values that containers leave out.
-
Question 20. Which command shows how much of namespace dev's ResourceQuota is in use?
Show answer
Answer: D. kubectl describe resourcequota -n dev
describe shows each quota's Used and Hard values.
-
Question 21. Which command creates a ConfigMap named app from the file app.properties?
Show answer
Answer: A. kubectl create configmap app --from-file=app.properties
--from-file makes one key per file, named after the file unless you give a key=path form.
-
Question 22. Which command creates a ConfigMap in which each KEY=value line of the file .env becomes its own key?
Show answer
Answer: B. kubectl create configmap app --from-env-file=.env
--from-env-file parses the lines. --from-file would store the whole file under a single key.
-
Question 23. How does a container read the single key LOG_LEVEL from ConfigMap app as an environment variable?
Show answer
Answer: C. env with valueFrom.configMapKeyRef
env[].valueFrom.configMapKeyRef selects one key. envFrom imports every key and can't select one.
-
Question 24. A container gets an environment variable from a ConfigMap, and the ConfigMap is then edited. When does the container see the new value?
Show answer
Answer: D. Only after the container is restarted
Environment variables are set when the container starts. Mounted ConfigMap volumes, without subPath, are updated in place.
-
Question 25. A Pod references a ConfigMap that may not exist yet. How can the Pod start anyway?
Show answer
Answer: A. Set optional: true on the reference
Without optional: true, the container won't start until the ConfigMap or key exists.
-
Question 26. What does immutable: true do on a ConfigMap?
Show answer
Answer: B. Blocks changes to its data and cuts API server watch load
An immutable ConfigMap can't be edited, only deleted and recreated. The kubelet stops watching it, which helps large clusters.
-
Question 27. What is the maximum size of the data in one ConfigMap?
Show answer
Answer: C. 1 MiB
ConfigMaps and Secrets are capped at 1 MiB. Larger data belongs in a volume or an external store.
-
Question 28. A ConfigMap is mounted as a volume. Which field sets the file name a particular key is written to?
Show answer
Answer: D. items, with key and path
items lists the keys to project and the relative path for each; keys not listed are left out.
-
Question 29. Which command creates a TLS Secret from cert.pem and key.pem?
Show answer
Answer: B. kubectl create secret tls web-tls --cert=cert.pem --key=key.pem
This creates a kubernetes.io/tls Secret with the keys tls.crt and tls.key.
-
Question 30. How does a Pod pull its image from a private registry?
Show answer
Answer: C. Reference a docker-registry Secret in imagePullSecrets
imagePullSecrets can be set on the Pod or attached to its ServiceAccount so every Pod using it gets them.
-
Question 31. Which command creates a Secret holding registry credentials for image pulls?
Show answer
Answer: D. kubectl create secret docker-registry regcred --docker-server=...
docker-registry creates a kubernetes.io/dockerconfigjson Secret from --docker-server, --docker-username, and --docker-password.
-
Question 32. In a Secret manifest, which field accepts plain-text values that are encoded for you?
Show answer
Answer: A. stringData
stringData is write-only convenience: the values are merged into data as base64 when stored.
-
Question 33. Why is the base64 encoding in a Secret not a security control?
Show answer
Answer: B. Anyone who can read the Secret can decode it
Base64 is an encoding, not encryption. Protect Secrets with RBAC, encryption at rest, and care about who can create Pods that mount them.
-
Question 34. What protects Secret data in etcd from someone who gets a copy of the database files?
Show answer
Answer: C. Encryption at rest configured on the API server
An EncryptionConfiguration (for example with a KMS provider) makes the API server encrypt Secrets before writing them to etcd.
-
Question 35. A Secret is mounted as a volume. Which field sets the permissions of its files, such as 0400?
Show answer
Answer: D. defaultMode on the secret volume
defaultMode sets the mode for every file; items[].mode overrides it for single keys.
-
Question 36. Which securityContext setting applies the container runtime's default seccomp profile?
Show answer
Answer: A. seccompProfile type: RuntimeDefault
RuntimeDefault blocks many rarely needed syscalls. The restricted Pod Security Standard requires RuntimeDefault or Localhost.
-
Question 37. Which ServiceAccount does a Pod use if its spec doesn't name one?
Show answer
Answer: B. default in the Pod's namespace
Every namespace gets a ServiceAccount named default, which Pods use unless serviceAccountName is set.
-
Question 38. Which Pod field makes the Pod run as ServiceAccount reporter?
Show answer
Answer: C. serviceAccountName: reporter
spec.serviceAccountName selects the account. It must exist in the same namespace as the Pod.
-
Question 39. Where is the ServiceAccount token mounted in a container by default?
Show answer
Answer: D. /var/run/secrets/kubernetes.io/serviceaccount
The directory holds token, ca.crt, and namespace. The token is short-lived and refreshed by the kubelet.
-
Question 40. A Pod never calls the Kubernetes API. How do you stop a token being mounted into it?
Show answer
Answer: A. Set automountServiceAccountToken: false
It can be set on the ServiceAccount or the Pod; the Pod's setting wins. This removes a credential an attacker could use.
-
Question 41. Which command issues a short-lived token for ServiceAccount ci-bot?
Show answer
Answer: B. kubectl create token ci-bot
kubectl create token uses the TokenRequest API. Add --duration to change the lifetime. Long-lived token Secrets are no longer created automatically.
-
Question 42. Can you change the ServiceAccount of a running Pod?
Show answer
Answer: C. No; change the template so new Pods replace it
serviceAccountName is immutable on a Pod. Change the Deployment's template (for example with kubectl set serviceaccount) so new Pods use the new account.
-
Question 43. Which securityContext setting makes the kubelet refuse to start a container that would run as UID 0?
Show answer
Answer: D. runAsNonRoot: true
With runAsNonRoot: true, the kubelet checks the effective UID and fails the container with CreateContainerConfigError if it's root.
-
Question 44. Which setting stops a process gaining more privileges than its parent, for example through setuid binaries?
Show answer
Answer: A. allowPrivilegeEscalation: false
It sets the no_new_privs flag on the process. It's always true when the container is privileged or has CAP_SYS_ADMIN.
-
Question 45. An app running as a non-root user must bind to port 80. Which change grants the least privilege?
Show answer
Answer: B. Add only the NET_BIND_SERVICE capability
NET_BIND_SERVICE allows binding to ports below 1024. A common pattern is to drop ALL and add back only what's needed.
-
Question 46. runAsUser is 1000 in the Pod's securityContext and 2000 in one container's securityContext. Which UID does that container run as?
Show answer
Answer: C. 2000
Container-level securityContext fields override the same fields set at Pod level.
-
Question 47. Which Pod securityContext field sets the group owner of mounted volumes so non-root containers can write to them?
Show answer
Answer: D. fsGroup
For volumes that support ownership management, the kubelet changes their group to fsGroup and adds that group to the containers' processes.
-
Question 48. Which setting makes a container's root filesystem read-only, with writable paths supplied through volumes?
Show answer
Answer: A. readOnlyRootFilesystem: true
It stops an attacker modifying binaries or dropping tools. Mount an emptyDir for paths like /tmp that the app must write to.
CKAD, Certified Kubernetes Application Developer, and Kubernetes are trademarks of The Linux Foundation. These questions are original study material, not questions from the real exam.