WebMagicInformatica
CKAD practice questions

CKAD practice questions: Application Environment, Configuration and Security

5 free questions on Application Environment, Configuration and Security, 25% of the Kubernetes: CKAD exam. Try each one, then open the answer and explanation. None of them are in the free readiness check, so you can still take it fresh.

Question 1

A namespace enforces the Pod Security Standard restricted. As an application developer you must keep the enforcement. Creating your Pod fails with violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false. What should you do?

  1. A.

    Relabel the namespace with pod-security.kubernetes.io/enforce: privileged.

  2. B.

    Add a toleration for node.kubernetes.io/unschedulable.

  3. C.

    Update the container securityContext to comply, for example allowPrivilegeEscalation: false, runAsNonRoot: true, capabilities.drop: ["ALL"] and a seccompProfile of RuntimeDefault.

  4. D.

    Increase the Pod's memory limits.

Show answer and explanation

Answer: C

Pod Security admission rejects Pods that do not meet the namespace's level; the workload must be made compliant.

  • Lowering the namespace policy is an administrator decision and removes the protection.
  • Tolerations and memory limits have no effect on admission.
Question 2

A namespace has a ResourceQuota with pods: "10". A Deployment is scaled to 12 replicas but only 10 Pods exist. How do you confirm the cause?

  1. A.

    Run kubectl describe replicaset (or check events) for the Deployment and look for a forbidden: exceeded quota message.

  2. B.

    Run kubectl top nodes and look for CPU pressure.

  3. C.

    Run kubectl logs deployment/web for scheduler messages.

  4. D.

    Run kubectl get pv for unbound volumes.

Show answer and explanation

Answer: A

When the quota is reached, the ReplicaSet controller cannot create Pods and records exceeded quota events. Raise the quota or reduce replicas (kubectl describe quota shows usage).

  • Node CPU pressure would produce Pending Pods, not missing Pods.
  • Application logs do not include admission errors.
  • Volumes are unrelated.
Question 3

A container must run as a non-root user, have a read-only root filesystem, and drop all Linux capabilities. Which container securityContext is correct?

  1. A.
    securityContext:
      runAsUser: 0
      readOnlyRootFilesystem: true
      capabilities:
        drop: ["ALL"]
  2. B.
    securityContext:
      runAsNonRoot: true
      readOnlyRootFilesystem: false
      capabilities:
        drop: ["ALL"]
  3. C.
    securityContext:
      runAsNonRoot: true
      readOnlyRootFilesystem: true
      capabilities:
        add: ["ALL"]
  4. D.
    securityContext:
      runAsNonRoot: true
      runAsUser: 10001
      readOnlyRootFilesystem: true
      capabilities:
        drop: ["ALL"]
Show answer and explanation

Answer: D

runAsNonRoot with a non-zero runAsUser, readOnlyRootFilesystem: true and capabilities.drop: ["ALL"] meet all three requirements.

  • User ID 0 is root.
  • readOnlyRootFilesystem: false leaves the filesystem writable.
  • add: ["ALL"] grants every capability.
Question 4Choose 2

Which TWO statements about ServiceAccount tokens in current Kubernetes versions are correct? (Choose two.)

  1. A.

    The token is stored in /etc/kubernetes/pki inside the container.

  2. B.

    kubectl create token <serviceaccount> requests a short-lived token for use outside the cluster.

  3. C.

    A token grants the same permissions to every ServiceAccount in the namespace.

  4. D.

    A permanent Secret holding a never-expiring token is created automatically for every ServiceAccount.

  5. E.

    Pods get a projected token, mounted by default at /var/run/secrets/kubernetes.io/serviceaccount/token, that is time-limited and refreshed by the kubelet.

Show answer and explanation

Answer: B and E

Since Kubernetes 1.24 tokens are short-lived (bound) and projected into Pods; long-lived Secret tokens must be requested explicitly.

  • Legacy auto-created token Secrets are no longer generated.
  • /etc/kubernetes/pki is a control plane path.
  • Permissions come from the RBAC bindings of each ServiceAccount.
Question 5

You want to get a short-lived API token for the ServiceAccount app-sa in the current namespace. Which command?

  1. A.

    kubectl create token app-sa

  2. B.

    kubectl get secret app-sa-token

  3. C.

    kubectl describe serviceaccount app-sa --token

  4. D.

    kubectl auth token app-sa

Show answer and explanation

Answer: A

kubectl create token SERVICEACCOUNT calls the TokenRequest API and prints a time-limited token.

  • A token Secret is no longer created automatically.
  • describe has no --token flag, and kubectl auth has no token subcommand.

How ready are you for CKAD?

Take the free readiness check: 15 questions from every exam domain in 20 minutes, with your score per domain.

  • 20 minutes
  • 15 questions
  • Free with an account

More CKAD practice by topic

Back to the CKAD practice test →

Independent practice material written from the official exam guide. Not affiliated with or endorsed by the exam provider.