CertKeen
CNCF

Certified Kubernetes Administrator (CKA) Practice Exam

Practice questions for the Certified Kubernetes Administrator (CKA) exam on Kubernetes v1.37: troubleshooting NotReady nodes, the kubelet, static control plane pods, crictl, metrics-server and kubectl top, container logs and events, Service endpoints, DNS, NetworkPolicies and kube-proxy; cluster architecture, installation and configuration with RBAC and ServiceAccounts, host preparation, kubeadm init, join and upgrades, version skew, etcd backup and restore, certificate renewal, highly available control planes, Helm, Kustomize, CNI, CSI, CRI, CRDs and operators; services and networking with the pod network model, ClusterIP, NodePort, LoadBalancer, headless and ExternalName Services, EndpointSlices, Gateway API, Ingress and CoreDNS; workloads and scheduling with Deployments and rollouts, ConfigMaps, autoscaling, StatefulSets, DaemonSets, PodDisruptionBudgets, LimitRanges, ResourceQuotas, affinity, taints and tolerations, topology spread and priority; and storage with StorageClasses, dynamic provisioning, access modes, reclaim policies and volume expansion. Every question includes a written explanation.

100 questions · 12 free preview

$19 · lifetime access
Try free sample

Studying more than one? All CNCF exams for $29 · every exam for $79

Free sample questions

  1. Sample · question 1 · Drain flags for DaemonSets and emptyDir

    Before kernel patching, an operator at Brackwater Shipping runs kubectl drain on node n-14. It refuses because the node hosts a logging DaemonSet pod and a pod using a local scratch volume. Which TWO flags let the drain proceed? (Select TWO.)

    • A.--ignore-daemonsetscorrect
    • B.--keep-volumes
    • C.--evict-statics
    • D.--delete-emptydir-datacorrect
    • E.--skip-pdb

    Why: DaemonSet-managed pods would be re-created on the same node right away, so drain skips them only when --ignore-daemonsets is given. Pods with emptyDir volumes lose that data on eviction, so drain needs --delete-emptydir-data to confirm. The other flags are not kubectl drain options; static pods are never evicted by drain.

    Open this question on its own page →
  2. Sample · question 2 · CronJob concurrencyPolicy Forbid

    A nightly CronJob at Holloway Dyes sometimes runs longer than its 30-minute schedule interval, and two runs then overlap and corrupt a report. Which setting makes the controller skip a new run while the previous one is still active?

    • A.concurrencyPolicy: Forbidcorrect
    • B.suspend: true
    • C.startingDeadlineSeconds: 0
    • D.concurrencyPolicy: Replace

    Why: Forbid skips a scheduled run if the previous Job has not finished. Replace would stop the running Job and start the new one, which is not wanted here. startingDeadlineSeconds controls how late a missed run may start, and suspend stops all future runs.

    Open this question on its own page →
  3. Sample · question 3 · Listing cluster-scoped API resources

    While writing ClusterRoles at Saffron Lane Hotels, an admin needs a list of all resource types that are not namespaced. Which command produces it?

    • A.kubectl explain --scope=cluster
    • B.kubectl api-versions --cluster-scoped
    • C.kubectl api-resources --namespaced=falsecorrect
    • D.kubectl get all --all-namespaces=false

    Why: kubectl api-resources lists every resource the API server serves, with short names, API groups and whether each is namespaced, and --namespaced=false filters to cluster-scoped kinds such as nodes and persistentvolumes. api-versions only lists group versions, get all returns a subset of namespaced objects, and explain documents fields of one resource.

    Open this question on its own page →
  4. Sample · question 4 · Setting the default namespace in a context

    An engineer at Merriden Toys works mostly in namespace inventory and is tired of typing -n inventory. Which command makes inventory the default namespace for the current kubeconfig context?

    • A.kubectl namespace set inventory --default --context=current
    • B.export KUBE_NAMESPACE=inventory
    • C.kubectl config use-context inventory
    • D.kubectl config set-context --current --namespace=inventorycorrect

    Why: Each kubeconfig context stores a cluster, a user and an optional namespace; set-context --current --namespace changes the namespace of the active context. use-context switches to a context with that name, kubectl has no namespace set command, and kubectl does not read a KUBE_NAMESPACE variable.

    Open this question on its own page →
  5. Sample · question 5 · Session affinity by client IP

    A legacy app at Calderbrook Florists stores sessions in memory, so each client must keep reaching the same pod behind its ClusterIP Service. Which Service setting does this?

    • A.clusterIP: None
    • B.sessionAffinity: ClientIPcorrect
    • C.externalTrafficPolicy: Cluster
    • D.ipFamilyPolicy: SingleStack

    Why: sessionAffinity: ClientIP makes kube-proxy send connections from the same client IP to the same backend pod, with a configurable timeout. externalTrafficPolicy concerns external traffic routing and source IPs, clusterIP: None makes the Service headless with no proxying, and ipFamilyPolicy chooses IPv4/IPv6 families.

    Open this question on its own page →
  6. Sample · question 6 · Pod dnsPolicy Default versus ClusterFirst

    A pod spec at Ullswater Mills sets dnsPolicy: Default. What DNS configuration does the pod get?

    • A.It uses cluster DNS, the usual default for pods
    • B.It gets no nameserver until dnsConfig is added
    • C.It uses CoreDNS only for Service names in its own namespace
    • D.It inherits the resolver settings of the node it runs oncorrect

    Why: Despite its name, Default is not the default policy: the pod inherits name resolution from its node, so cluster Service names do not resolve. The actual default is ClusterFirst, which uses cluster DNS. None ignores cluster settings and requires dnsConfig to supply resolvers.

    Open this question on its own page →
  7. Sample · question 7 · Raw block volumes with volumeMode

    A database at Kirkby Data wants a raw block device instead of a mounted file system from its PVC. Which fields are needed?

    • A.volumeMode: Block on the PVC, and volumeDevices in the containercorrect
    • B.volumeMode: Filesystem on the PVC, and mountPath: /dev/xvdb
    • C.fsType: none on the PVC, and readOnly: true in the container
    • D.accessModes: [Block] on the PVC, and volumeMounts in the container

    Why: Setting volumeMode: Block on the PVC requests a raw device, and the container then lists the volume under volumeDevices with a devicePath instead of volumeMounts. Filesystem is the default mode and gives a mounted file system, Block is not an access mode, and fsType is a storage parameter rather than a PVC field.

    Open this question on its own page →
  8. Sample · question 8 · Debugging a node with kubectl debug

    An admin at Thornaby Steel cannot SSH to node n-03 but has cluster-admin access. They need a shell to look at the node's files under /var/log. Which approach works?

    • A.kubectl cp node/n-03:/var/log ./node-logs
    • B.kubectl attach node/n-03 --shell, then look under /var/log
    • C.kubectl debug node/n-03 -it --image=busybox, then look under /host/var/logcorrect
    • D.kubectl exec node/n-03 -it -- sh, then look under /var/log

    Why: kubectl debug node/<name> creates a pod on that node in the host namespaces with the node's root file system mounted at /host, so node files are reachable under /host. kubectl exec, attach and cp act on containers in pods, not on nodes.

    Open this question on its own page →
  9. Sample · question 9 · CreateContainerConfigError from missing ConfigMap

    A pod at Rushmere Credit shows status CreateContainerConfigError. Its container uses envFrom with configMapRef name: rates-config. What is the likely cause?

    • A.The pod's liveness probe points at a port that the app does not open
    • B.The ConfigMap rates-config does not exist in the pod's namespacecorrect
    • C.The node has run out of allocatable memory
    • D.The image tag rates-config cannot be found

    Why: The kubelet cannot build the container configuration when a referenced ConfigMap or Secret is missing and the reference is not marked optional, and the events name the missing object. Creating the ConfigMap in the same namespace lets the container start. Image problems give ErrImagePull, memory shortage blocks scheduling, and probes only run after the container starts.

    Open this question on its own page →
  10. Sample · question 10 · Approving a client CertificateSigningRequest

    An admin at Yelverton Insurance created a CertificateSigningRequest named sara-csr for a new user with signerName kubernetes.io/kube-apiserver-client. It shows Pending. How is it approved so a certificate is issued?

    • A.kubeadm certs renew sara-csr
    • B.kubectl patch csr sara-csr -p '{"status":"Approved"}'
    • C.kubectl create token sara-csr --approve
    • D.kubectl certificate approve sara-csrcorrect

    Why: kubectl certificate approve adds the Approved condition to the CSR, after which the signer issues the certificate and it can be read from status.certificate. kubeadm certs renew handles kubeadm-managed control plane certificates, a normal patch cannot set the approval condition, and kubectl create token issues ServiceAccount tokens.

    Open this question on its own page →
  11. Sample · question 11 · NetworkPolicy ipBlock with except

    Pods in namespace export at Aysgarth Media may send traffic to the partner range 203.0.113.0/24 except the host 203.0.113.9. How is this written in an egress rule?

    • A.ipBlock: {cidr: 203.0.113.0/24, deny: [203.0.113.9]}
    • B.ipBlock: {cidr: 203.0.113.0/24, except: [203.0.113.9/32]}correct
    • C.namespaceSelector: {cidr: 203.0.113.0/24, except: [203.0.113.9]}
    • D.ipBlock: {cidr: 203.0.113.9/32, invert: true}

    Why: ipBlock selects IP ranges outside the pod network, and except lists CIDRs inside that range to leave out, so a /32 removes a single host. There is no deny or invert field, and namespaceSelector selects namespaces by label rather than by IP.

    Open this question on its own page →
  12. Sample · question 12 · Restoring a PVC from a VolumeSnapshot

    Dalbeattie Labs has the CSI snapshot CRDs and snapshot controller installed, and its CSI driver supports snapshots. They took a VolumeSnapshot named orders-snap of a CSI volume. How do they create a new PVC with that data?

    • A.Create a PVC whose dataSource is the VolumeSnapshot orders-snapcorrect
    • B.Run kubectl rollout undo volumesnapshot/orders-snap in the namespace
    • C.Edit orders-snap and set restore: true
    • D.Create a PV whose claimRef names orders-snap

    Why: A new PVC that sets dataSource to kind VolumeSnapshot, apiGroup snapshot.storage.k8s.io and name orders-snap asks the CSI driver to provision a volume pre-filled from the snapshot. VolumeSnapshot support relies on the snapshot CRDs and the snapshot controller, which are add-ons installed separately from core Kubernetes. The snapshot is a read-only source and has no restore field, claimRef ties a PV to a PVC rather than a snapshot, and rollout commands apply to workloads.

    Open this question on its own page →

Like the sample?

Other practice exams